1 | /* $Id: VBoxManageList.cpp 78512 2019-05-14 15:26:58Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - The 'list' command.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 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 | /*********************************************************************************************************************************
|
---|
22 | * Header Files *
|
---|
23 | *********************************************************************************************************************************/
|
---|
24 | #include <VBox/com/com.h>
|
---|
25 | #include <VBox/com/string.h>
|
---|
26 | #include <VBox/com/Guid.h>
|
---|
27 | #include <VBox/com/array.h>
|
---|
28 | #include <VBox/com/ErrorInfo.h>
|
---|
29 | #include <VBox/com/errorprint.h>
|
---|
30 |
|
---|
31 | #include <VBox/com/VirtualBox.h>
|
---|
32 |
|
---|
33 | #include <VBox/log.h>
|
---|
34 | #include <iprt/stream.h>
|
---|
35 | #include <iprt/string.h>
|
---|
36 | #include <iprt/time.h>
|
---|
37 | #include <iprt/getopt.h>
|
---|
38 | #include <iprt/ctype.h>
|
---|
39 |
|
---|
40 | #include <vector>
|
---|
41 | #include <algorithm>
|
---|
42 |
|
---|
43 | #include "VBoxManage.h"
|
---|
44 | using namespace com;
|
---|
45 |
|
---|
46 | #ifdef VBOX_WITH_HOSTNETIF_API
|
---|
47 | static 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 "Unknown";
|
---|
55 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
56 | case HostNetworkInterfaceMediumType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
57 | #endif
|
---|
58 | }
|
---|
59 | return "unknown";
|
---|
60 | }
|
---|
61 |
|
---|
62 | static const char *getHostIfStatusText(HostNetworkInterfaceStatus_T enmStatus)
|
---|
63 | {
|
---|
64 | switch (enmStatus)
|
---|
65 | {
|
---|
66 | case HostNetworkInterfaceStatus_Up: return "Up";
|
---|
67 | case HostNetworkInterfaceStatus_Down: return "Down";
|
---|
68 | case HostNetworkInterfaceStatus_Unknown: return "Unknown";
|
---|
69 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
70 | case HostNetworkInterfaceStatus_32BitHack: break; /* Shut up compiler warnings. */
|
---|
71 | #endif
|
---|
72 | }
|
---|
73 | return "unknown";
|
---|
74 | }
|
---|
75 | #endif /* VBOX_WITH_HOSTNETIF_API */
|
---|
76 |
|
---|
77 | static const char*getDeviceTypeText(DeviceType_T enmType)
|
---|
78 | {
|
---|
79 | switch (enmType)
|
---|
80 | {
|
---|
81 | case DeviceType_HardDisk: return "HardDisk";
|
---|
82 | case DeviceType_DVD: return "DVD";
|
---|
83 | case DeviceType_Floppy: return "Floppy";
|
---|
84 | /* Make MSC happy */
|
---|
85 | case DeviceType_Null: return "Null";
|
---|
86 | case DeviceType_Network: return "Network";
|
---|
87 | case DeviceType_USB: return "USB";
|
---|
88 | case DeviceType_SharedFolder: return "SharedFolder";
|
---|
89 | case DeviceType_Graphics3D: return "Graphics3D";
|
---|
90 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
91 | case DeviceType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
92 | #endif
|
---|
93 | }
|
---|
94 | return "Unknown";
|
---|
95 | }
|
---|
96 |
|
---|
97 |
|
---|
98 | /**
|
---|
99 | * List internal networks.
|
---|
100 | *
|
---|
101 | * @returns See produceList.
|
---|
102 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
103 | */
|
---|
104 | static 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("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 | */
|
---|
125 | static 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("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("Name: %ls\n", interfaceName.raw());
|
---|
157 | Bstr interfaceGuid;
|
---|
158 | networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
159 | RTPrintf("GUID: %ls\n", interfaceGuid.raw());
|
---|
160 | BOOL bDHCPEnabled;
|
---|
161 | networkInterface->COMGETTER(DHCPEnabled)(&bDHCPEnabled);
|
---|
162 | RTPrintf("DHCP: %s\n", bDHCPEnabled ? "Enabled" : "Disabled");
|
---|
163 |
|
---|
164 | Bstr IPAddress;
|
---|
165 | networkInterface->COMGETTER(IPAddress)(IPAddress.asOutParam());
|
---|
166 | RTPrintf("IPAddress: %ls\n", IPAddress.raw());
|
---|
167 | Bstr NetworkMask;
|
---|
168 | networkInterface->COMGETTER(NetworkMask)(NetworkMask.asOutParam());
|
---|
169 | RTPrintf("NetworkMask: %ls\n", NetworkMask.raw());
|
---|
170 | Bstr IPV6Address;
|
---|
171 | networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam());
|
---|
172 | RTPrintf("IPV6Address: %ls\n", IPV6Address.raw());
|
---|
173 | ULONG IPV6NetworkMaskPrefixLength;
|
---|
174 | networkInterface->COMGETTER(IPV6NetworkMaskPrefixLength)(&IPV6NetworkMaskPrefixLength);
|
---|
175 | RTPrintf("IPV6NetworkMaskPrefixLength: %d\n", IPV6NetworkMaskPrefixLength);
|
---|
176 | Bstr HardwareAddress;
|
---|
177 | networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam());
|
---|
178 | RTPrintf("HardwareAddress: %ls\n", HardwareAddress.raw());
|
---|
179 | HostNetworkInterfaceMediumType_T Type;
|
---|
180 | networkInterface->COMGETTER(MediumType)(&Type);
|
---|
181 | RTPrintf("MediumType: %s\n", getHostIfMediumTypeText(Type));
|
---|
182 | BOOL fWireless;
|
---|
183 | networkInterface->COMGETTER(Wireless)(&fWireless);
|
---|
184 | RTPrintf("Wireless: %s\n", fWireless ? "Yes" : "No");
|
---|
185 | HostNetworkInterfaceStatus_T Status;
|
---|
186 | networkInterface->COMGETTER(Status)(&Status);
|
---|
187 | RTPrintf("Status: %s\n", getHostIfStatusText(Status));
|
---|
188 | Bstr netName;
|
---|
189 | networkInterface->COMGETTER(NetworkName)(netName.asOutParam());
|
---|
190 | RTPrintf("VBoxNetworkName: %ls\n\n", netName.raw());
|
---|
191 | #endif
|
---|
192 | }
|
---|
193 | return rc;
|
---|
194 | }
|
---|
195 |
|
---|
196 |
|
---|
197 | /**
|
---|
198 | * List host information.
|
---|
199 | *
|
---|
200 | * @returns See produceList.
|
---|
201 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
202 | */
|
---|
203 | static HRESULT listHostInfo(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
204 | {
|
---|
205 | static struct
|
---|
206 | {
|
---|
207 | ProcessorFeature_T feature;
|
---|
208 | const char *pszName;
|
---|
209 | } features[]
|
---|
210 | =
|
---|
211 | {
|
---|
212 | { ProcessorFeature_HWVirtEx, "HW virtualization" },
|
---|
213 | { ProcessorFeature_PAE, "PAE" },
|
---|
214 | { ProcessorFeature_LongMode, "long mode" },
|
---|
215 | { ProcessorFeature_NestedPaging, "nested paging" },
|
---|
216 | };
|
---|
217 | HRESULT rc;
|
---|
218 | ComPtr<IHost> Host;
|
---|
219 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(Host.asOutParam()));
|
---|
220 |
|
---|
221 | RTPrintf("Host Information:\n\n");
|
---|
222 |
|
---|
223 | LONG64 u64UtcTime = 0;
|
---|
224 | CHECK_ERROR(Host, COMGETTER(UTCTime)(&u64UtcTime));
|
---|
225 | RTTIMESPEC timeSpec;
|
---|
226 | char szTime[32];
|
---|
227 | RTPrintf("Host time: %s\n", RTTimeSpecToString(RTTimeSpecSetMilli(&timeSpec, u64UtcTime), szTime, sizeof(szTime)));
|
---|
228 |
|
---|
229 | ULONG processorOnlineCount = 0;
|
---|
230 | CHECK_ERROR(Host, COMGETTER(ProcessorOnlineCount)(&processorOnlineCount));
|
---|
231 | RTPrintf("Processor online count: %lu\n", processorOnlineCount);
|
---|
232 | ULONG processorCount = 0;
|
---|
233 | CHECK_ERROR(Host, COMGETTER(ProcessorCount)(&processorCount));
|
---|
234 | RTPrintf("Processor count: %lu\n", processorCount);
|
---|
235 | ULONG processorOnlineCoreCount = 0;
|
---|
236 | CHECK_ERROR(Host, COMGETTER(ProcessorOnlineCoreCount)(&processorOnlineCoreCount));
|
---|
237 | RTPrintf("Processor online core count: %lu\n", processorOnlineCoreCount);
|
---|
238 | ULONG processorCoreCount = 0;
|
---|
239 | CHECK_ERROR(Host, COMGETTER(ProcessorCoreCount)(&processorCoreCount));
|
---|
240 | RTPrintf("Processor core count: %lu\n", processorCoreCount);
|
---|
241 | for (unsigned i = 0; i < RT_ELEMENTS(features); i++)
|
---|
242 | {
|
---|
243 | BOOL supported;
|
---|
244 | CHECK_ERROR(Host, GetProcessorFeature(features[i].feature, &supported));
|
---|
245 | RTPrintf("Processor supports %s: %s\n", features[i].pszName, supported ? "yes" : "no");
|
---|
246 | }
|
---|
247 | for (ULONG i = 0; i < processorCount; i++)
|
---|
248 | {
|
---|
249 | ULONG processorSpeed = 0;
|
---|
250 | CHECK_ERROR(Host, GetProcessorSpeed(i, &processorSpeed));
|
---|
251 | if (processorSpeed)
|
---|
252 | RTPrintf("Processor#%u speed: %lu MHz\n", i, processorSpeed);
|
---|
253 | else
|
---|
254 | RTPrintf("Processor#%u speed: unknown\n", i);
|
---|
255 | Bstr processorDescription;
|
---|
256 | CHECK_ERROR(Host, GetProcessorDescription(i, processorDescription.asOutParam()));
|
---|
257 | RTPrintf("Processor#%u description: %ls\n", i, processorDescription.raw());
|
---|
258 | }
|
---|
259 |
|
---|
260 | ULONG memorySize = 0;
|
---|
261 | CHECK_ERROR(Host, COMGETTER(MemorySize)(&memorySize));
|
---|
262 | RTPrintf("Memory size: %lu MByte\n", memorySize);
|
---|
263 |
|
---|
264 | ULONG memoryAvailable = 0;
|
---|
265 | CHECK_ERROR(Host, COMGETTER(MemoryAvailable)(&memoryAvailable));
|
---|
266 | RTPrintf("Memory available: %lu MByte\n", memoryAvailable);
|
---|
267 |
|
---|
268 | Bstr operatingSystem;
|
---|
269 | CHECK_ERROR(Host, COMGETTER(OperatingSystem)(operatingSystem.asOutParam()));
|
---|
270 | RTPrintf("Operating system: %ls\n", operatingSystem.raw());
|
---|
271 |
|
---|
272 | Bstr oSVersion;
|
---|
273 | CHECK_ERROR(Host, COMGETTER(OSVersion)(oSVersion.asOutParam()));
|
---|
274 | RTPrintf("Operating system version: %ls\n", oSVersion.raw());
|
---|
275 | return rc;
|
---|
276 | }
|
---|
277 |
|
---|
278 |
|
---|
279 | /**
|
---|
280 | * List media information.
|
---|
281 | *
|
---|
282 | * @returns See produceList.
|
---|
283 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
284 | * @param aMedia Medium objects to list information for.
|
---|
285 | * @param pszParentUUIDStr String with the parent UUID string (or "base").
|
---|
286 | * @param fOptLong Long (@c true) or short list format.
|
---|
287 | */
|
---|
288 | static HRESULT listMedia(const ComPtr<IVirtualBox> pVirtualBox,
|
---|
289 | const com::SafeIfaceArray<IMedium> &aMedia,
|
---|
290 | const char *pszParentUUIDStr,
|
---|
291 | bool fOptLong)
|
---|
292 | {
|
---|
293 | HRESULT rc = S_OK;
|
---|
294 | for (size_t i = 0; i < aMedia.size(); ++i)
|
---|
295 | {
|
---|
296 | ComPtr<IMedium> pMedium = aMedia[i];
|
---|
297 |
|
---|
298 | rc = showMediumInfo(pVirtualBox, pMedium, pszParentUUIDStr, fOptLong);
|
---|
299 |
|
---|
300 | RTPrintf("\n");
|
---|
301 |
|
---|
302 | com::SafeIfaceArray<IMedium> children;
|
---|
303 | CHECK_ERROR(pMedium, COMGETTER(Children)(ComSafeArrayAsOutParam(children)));
|
---|
304 | if (children.size() > 0)
|
---|
305 | {
|
---|
306 | Bstr uuid;
|
---|
307 | pMedium->COMGETTER(Id)(uuid.asOutParam());
|
---|
308 |
|
---|
309 | // depth first listing of child media
|
---|
310 | rc = listMedia(pVirtualBox, children, Utf8Str(uuid).c_str(), fOptLong);
|
---|
311 | }
|
---|
312 | }
|
---|
313 |
|
---|
314 | return rc;
|
---|
315 | }
|
---|
316 |
|
---|
317 |
|
---|
318 | /**
|
---|
319 | * List virtual image backends.
|
---|
320 | *
|
---|
321 | * @returns See produceList.
|
---|
322 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
323 | */
|
---|
324 | static HRESULT listHddBackends(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
325 | {
|
---|
326 | HRESULT rc;
|
---|
327 | ComPtr<ISystemProperties> systemProperties;
|
---|
328 | CHECK_ERROR(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()));
|
---|
329 | com::SafeIfaceArray<IMediumFormat> mediumFormats;
|
---|
330 | CHECK_ERROR(systemProperties, COMGETTER(MediumFormats)(ComSafeArrayAsOutParam(mediumFormats)));
|
---|
331 |
|
---|
332 | RTPrintf("Supported hard disk backends:\n\n");
|
---|
333 | for (size_t i = 0; i < mediumFormats.size(); ++i)
|
---|
334 | {
|
---|
335 | /* General information */
|
---|
336 | Bstr id;
|
---|
337 | CHECK_ERROR(mediumFormats[i], COMGETTER(Id)(id.asOutParam()));
|
---|
338 |
|
---|
339 | Bstr description;
|
---|
340 | CHECK_ERROR(mediumFormats[i],
|
---|
341 | COMGETTER(Name)(description.asOutParam()));
|
---|
342 |
|
---|
343 | ULONG caps = 0;
|
---|
344 | com::SafeArray <MediumFormatCapabilities_T> mediumFormatCap;
|
---|
345 | CHECK_ERROR(mediumFormats[i],
|
---|
346 | COMGETTER(Capabilities)(ComSafeArrayAsOutParam(mediumFormatCap)));
|
---|
347 | for (ULONG j = 0; j < mediumFormatCap.size(); j++)
|
---|
348 | caps |= mediumFormatCap[j];
|
---|
349 |
|
---|
350 |
|
---|
351 | RTPrintf("Backend %u: id='%ls' description='%ls' capabilities=%#06x extensions='",
|
---|
352 | i, id.raw(), description.raw(), caps);
|
---|
353 |
|
---|
354 | /* File extensions */
|
---|
355 | com::SafeArray<BSTR> fileExtensions;
|
---|
356 | com::SafeArray<DeviceType_T> deviceTypes;
|
---|
357 | CHECK_ERROR(mediumFormats[i],
|
---|
358 | DescribeFileExtensions(ComSafeArrayAsOutParam(fileExtensions), ComSafeArrayAsOutParam(deviceTypes)));
|
---|
359 | for (size_t j = 0; j < fileExtensions.size(); ++j)
|
---|
360 | {
|
---|
361 | RTPrintf("%ls (%s)", Bstr(fileExtensions[j]).raw(), getDeviceTypeText(deviceTypes[j]));
|
---|
362 | if (j != fileExtensions.size()-1)
|
---|
363 | RTPrintf(",");
|
---|
364 | }
|
---|
365 | RTPrintf("'");
|
---|
366 |
|
---|
367 | /* Configuration keys */
|
---|
368 | com::SafeArray<BSTR> propertyNames;
|
---|
369 | com::SafeArray<BSTR> propertyDescriptions;
|
---|
370 | com::SafeArray<DataType_T> propertyTypes;
|
---|
371 | com::SafeArray<ULONG> propertyFlags;
|
---|
372 | com::SafeArray<BSTR> propertyDefaults;
|
---|
373 | CHECK_ERROR(mediumFormats[i],
|
---|
374 | DescribeProperties(ComSafeArrayAsOutParam(propertyNames),
|
---|
375 | ComSafeArrayAsOutParam(propertyDescriptions),
|
---|
376 | ComSafeArrayAsOutParam(propertyTypes),
|
---|
377 | ComSafeArrayAsOutParam(propertyFlags),
|
---|
378 | ComSafeArrayAsOutParam(propertyDefaults)));
|
---|
379 |
|
---|
380 | RTPrintf(" properties=(");
|
---|
381 | if (propertyNames.size() > 0)
|
---|
382 | {
|
---|
383 | for (size_t j = 0; j < propertyNames.size(); ++j)
|
---|
384 | {
|
---|
385 | RTPrintf("\n name='%ls' desc='%ls' type=",
|
---|
386 | Bstr(propertyNames[j]).raw(), Bstr(propertyDescriptions[j]).raw());
|
---|
387 | switch (propertyTypes[j])
|
---|
388 | {
|
---|
389 | case DataType_Int32: RTPrintf("int"); break;
|
---|
390 | case DataType_Int8: RTPrintf("byte"); break;
|
---|
391 | case DataType_String: RTPrintf("string"); break;
|
---|
392 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
393 | case DataType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
394 | #endif
|
---|
395 | }
|
---|
396 | RTPrintf(" flags=%#04x", propertyFlags[j]);
|
---|
397 | RTPrintf(" default='%ls'", Bstr(propertyDefaults[j]).raw());
|
---|
398 | if (j != propertyNames.size()-1)
|
---|
399 | RTPrintf(", ");
|
---|
400 | }
|
---|
401 | }
|
---|
402 | RTPrintf(")\n");
|
---|
403 | }
|
---|
404 | return rc;
|
---|
405 | }
|
---|
406 |
|
---|
407 |
|
---|
408 | /**
|
---|
409 | * List USB devices attached to the host.
|
---|
410 | *
|
---|
411 | * @returns See produceList.
|
---|
412 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
413 | */
|
---|
414 | static HRESULT listUsbHost(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
415 | {
|
---|
416 | HRESULT rc;
|
---|
417 | ComPtr<IHost> Host;
|
---|
418 | CHECK_ERROR_RET(pVirtualBox, COMGETTER(Host)(Host.asOutParam()), 1);
|
---|
419 |
|
---|
420 | SafeIfaceArray<IHostUSBDevice> CollPtr;
|
---|
421 | CHECK_ERROR_RET(Host, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(CollPtr)), 1);
|
---|
422 |
|
---|
423 | RTPrintf("Host USB Devices:\n\n");
|
---|
424 |
|
---|
425 | if (CollPtr.size() == 0)
|
---|
426 | {
|
---|
427 | RTPrintf("<none>\n\n");
|
---|
428 | }
|
---|
429 | else
|
---|
430 | {
|
---|
431 | for (size_t i = 0; i < CollPtr.size(); ++i)
|
---|
432 | {
|
---|
433 | ComPtr<IHostUSBDevice> dev = CollPtr[i];
|
---|
434 |
|
---|
435 | /* Query info. */
|
---|
436 | Bstr id;
|
---|
437 | CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), 1);
|
---|
438 | USHORT usVendorId;
|
---|
439 | CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), 1);
|
---|
440 | USHORT usProductId;
|
---|
441 | CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), 1);
|
---|
442 | USHORT bcdRevision;
|
---|
443 | CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), 1);
|
---|
444 | USHORT usPort;
|
---|
445 | CHECK_ERROR_RET(dev, COMGETTER(Port)(&usPort), 1);
|
---|
446 | USHORT usVersion;
|
---|
447 | CHECK_ERROR_RET(dev, COMGETTER(Version)(&usVersion), 1);
|
---|
448 | USHORT usPortVersion;
|
---|
449 | CHECK_ERROR_RET(dev, COMGETTER(PortVersion)(&usPortVersion), 1);
|
---|
450 | USBConnectionSpeed_T enmSpeed;
|
---|
451 | CHECK_ERROR_RET(dev, COMGETTER(Speed)(&enmSpeed), 1);
|
---|
452 |
|
---|
453 | RTPrintf("UUID: %s\n"
|
---|
454 | "VendorId: %#06x (%04X)\n"
|
---|
455 | "ProductId: %#06x (%04X)\n"
|
---|
456 | "Revision: %u.%u (%02u%02u)\n"
|
---|
457 | "Port: %u\n",
|
---|
458 | Utf8Str(id).c_str(),
|
---|
459 | usVendorId, usVendorId, usProductId, usProductId,
|
---|
460 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
461 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
462 | usPort);
|
---|
463 |
|
---|
464 | const char *pszSpeed = "?";
|
---|
465 | switch (enmSpeed)
|
---|
466 | {
|
---|
467 | case USBConnectionSpeed_Low:
|
---|
468 | pszSpeed = "Low";
|
---|
469 | break;
|
---|
470 | case USBConnectionSpeed_Full:
|
---|
471 | pszSpeed = "Full";
|
---|
472 | break;
|
---|
473 | case USBConnectionSpeed_High:
|
---|
474 | pszSpeed = "High";
|
---|
475 | break;
|
---|
476 | case USBConnectionSpeed_Super:
|
---|
477 | pszSpeed = "Super";
|
---|
478 | break;
|
---|
479 | case USBConnectionSpeed_SuperPlus:
|
---|
480 | pszSpeed = "SuperPlus";
|
---|
481 | break;
|
---|
482 | default:
|
---|
483 | ASSERT(false);
|
---|
484 | break;
|
---|
485 | }
|
---|
486 |
|
---|
487 | RTPrintf("USB version/speed: %u/%s\n", usVersion, pszSpeed);
|
---|
488 |
|
---|
489 | /* optional stuff. */
|
---|
490 | SafeArray<BSTR> CollDevInfo;
|
---|
491 | Bstr bstr;
|
---|
492 | CHECK_ERROR_RET(dev, COMGETTER(DeviceInfo)(ComSafeArrayAsOutParam(CollDevInfo)), 1);
|
---|
493 | if (CollDevInfo.size() >= 1)
|
---|
494 | bstr = Bstr(CollDevInfo[0]);
|
---|
495 | if (!bstr.isEmpty())
|
---|
496 | RTPrintf("Manufacturer: %ls\n", bstr.raw());
|
---|
497 | if (CollDevInfo.size() >= 2)
|
---|
498 | bstr = Bstr(CollDevInfo[1]);
|
---|
499 | if (!bstr.isEmpty())
|
---|
500 | RTPrintf("Product: %ls\n", bstr.raw());
|
---|
501 | CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
|
---|
502 | if (!bstr.isEmpty())
|
---|
503 | RTPrintf("SerialNumber: %ls\n", bstr.raw());
|
---|
504 | CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), 1);
|
---|
505 | if (!bstr.isEmpty())
|
---|
506 | RTPrintf("Address: %ls\n", bstr.raw());
|
---|
507 |
|
---|
508 | /* current state */
|
---|
509 | USBDeviceState_T state;
|
---|
510 | CHECK_ERROR_RET(dev, COMGETTER(State)(&state), 1);
|
---|
511 | const char *pszState = "?";
|
---|
512 | switch (state)
|
---|
513 | {
|
---|
514 | case USBDeviceState_NotSupported:
|
---|
515 | pszState = "Not supported";
|
---|
516 | break;
|
---|
517 | case USBDeviceState_Unavailable:
|
---|
518 | pszState = "Unavailable";
|
---|
519 | break;
|
---|
520 | case USBDeviceState_Busy:
|
---|
521 | pszState = "Busy";
|
---|
522 | break;
|
---|
523 | case USBDeviceState_Available:
|
---|
524 | pszState = "Available";
|
---|
525 | break;
|
---|
526 | case USBDeviceState_Held:
|
---|
527 | pszState = "Held";
|
---|
528 | break;
|
---|
529 | case USBDeviceState_Captured:
|
---|
530 | pszState = "Captured";
|
---|
531 | break;
|
---|
532 | default:
|
---|
533 | ASSERT(false);
|
---|
534 | break;
|
---|
535 | }
|
---|
536 | RTPrintf("Current State: %s\n\n", pszState);
|
---|
537 | }
|
---|
538 | }
|
---|
539 | return rc;
|
---|
540 | }
|
---|
541 |
|
---|
542 |
|
---|
543 | /**
|
---|
544 | * List USB filters.
|
---|
545 | *
|
---|
546 | * @returns See produceList.
|
---|
547 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
548 | */
|
---|
549 | static HRESULT listUsbFilters(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
550 | {
|
---|
551 | HRESULT rc;
|
---|
552 |
|
---|
553 | RTPrintf("Global USB Device Filters:\n\n");
|
---|
554 |
|
---|
555 | ComPtr<IHost> host;
|
---|
556 | CHECK_ERROR_RET(pVirtualBox, COMGETTER(Host)(host.asOutParam()), 1);
|
---|
557 |
|
---|
558 | SafeIfaceArray<IHostUSBDeviceFilter> coll;
|
---|
559 | CHECK_ERROR_RET(host, COMGETTER(USBDeviceFilters)(ComSafeArrayAsOutParam(coll)), 1);
|
---|
560 |
|
---|
561 | if (coll.size() == 0)
|
---|
562 | {
|
---|
563 | RTPrintf("<none>\n\n");
|
---|
564 | }
|
---|
565 | else
|
---|
566 | {
|
---|
567 | for (size_t index = 0; index < coll.size(); ++index)
|
---|
568 | {
|
---|
569 | ComPtr<IHostUSBDeviceFilter> flt = coll[index];
|
---|
570 |
|
---|
571 | /* Query info. */
|
---|
572 |
|
---|
573 | RTPrintf("Index: %zu\n", index);
|
---|
574 |
|
---|
575 | BOOL active = FALSE;
|
---|
576 | CHECK_ERROR_RET(flt, COMGETTER(Active)(&active), 1);
|
---|
577 | RTPrintf("Active: %s\n", active ? "yes" : "no");
|
---|
578 |
|
---|
579 | USBDeviceFilterAction_T action;
|
---|
580 | CHECK_ERROR_RET(flt, COMGETTER(Action)(&action), 1);
|
---|
581 | const char *pszAction = "<invalid>";
|
---|
582 | switch (action)
|
---|
583 | {
|
---|
584 | case USBDeviceFilterAction_Ignore:
|
---|
585 | pszAction = "Ignore";
|
---|
586 | break;
|
---|
587 | case USBDeviceFilterAction_Hold:
|
---|
588 | pszAction = "Hold";
|
---|
589 | break;
|
---|
590 | default:
|
---|
591 | break;
|
---|
592 | }
|
---|
593 | RTPrintf("Action: %s\n", pszAction);
|
---|
594 |
|
---|
595 | Bstr bstr;
|
---|
596 | CHECK_ERROR_RET(flt, COMGETTER(Name)(bstr.asOutParam()), 1);
|
---|
597 | RTPrintf("Name: %ls\n", bstr.raw());
|
---|
598 | CHECK_ERROR_RET(flt, COMGETTER(VendorId)(bstr.asOutParam()), 1);
|
---|
599 | RTPrintf("VendorId: %ls\n", bstr.raw());
|
---|
600 | CHECK_ERROR_RET(flt, COMGETTER(ProductId)(bstr.asOutParam()), 1);
|
---|
601 | RTPrintf("ProductId: %ls\n", bstr.raw());
|
---|
602 | CHECK_ERROR_RET(flt, COMGETTER(Revision)(bstr.asOutParam()), 1);
|
---|
603 | RTPrintf("Revision: %ls\n", bstr.raw());
|
---|
604 | CHECK_ERROR_RET(flt, COMGETTER(Manufacturer)(bstr.asOutParam()), 1);
|
---|
605 | RTPrintf("Manufacturer: %ls\n", bstr.raw());
|
---|
606 | CHECK_ERROR_RET(flt, COMGETTER(Product)(bstr.asOutParam()), 1);
|
---|
607 | RTPrintf("Product: %ls\n", bstr.raw());
|
---|
608 | CHECK_ERROR_RET(flt, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
|
---|
609 | RTPrintf("Serial Number: %ls\n\n", bstr.raw());
|
---|
610 | }
|
---|
611 | }
|
---|
612 | return rc;
|
---|
613 | }
|
---|
614 |
|
---|
615 |
|
---|
616 | /**
|
---|
617 | * List system properties.
|
---|
618 | *
|
---|
619 | * @returns See produceList.
|
---|
620 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
621 | */
|
---|
622 | static HRESULT listSystemProperties(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
623 | {
|
---|
624 | ComPtr<ISystemProperties> systemProperties;
|
---|
625 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck);
|
---|
626 |
|
---|
627 | Bstr str;
|
---|
628 | ULONG ulValue;
|
---|
629 | LONG64 i64Value;
|
---|
630 | BOOL fValue;
|
---|
631 | const char *psz;
|
---|
632 |
|
---|
633 | pVirtualBox->COMGETTER(APIVersion)(str.asOutParam());
|
---|
634 | RTPrintf("API version: %ls\n", str.raw());
|
---|
635 |
|
---|
636 | systemProperties->COMGETTER(MinGuestRAM)(&ulValue);
|
---|
637 | RTPrintf("Minimum guest RAM size: %u Megabytes\n", ulValue);
|
---|
638 | systemProperties->COMGETTER(MaxGuestRAM)(&ulValue);
|
---|
639 | RTPrintf("Maximum guest RAM size: %u Megabytes\n", ulValue);
|
---|
640 | systemProperties->COMGETTER(MinGuestVRAM)(&ulValue);
|
---|
641 | RTPrintf("Minimum video RAM size: %u Megabytes\n", ulValue);
|
---|
642 | systemProperties->COMGETTER(MaxGuestVRAM)(&ulValue);
|
---|
643 | RTPrintf("Maximum video RAM size: %u Megabytes\n", ulValue);
|
---|
644 | systemProperties->COMGETTER(MaxGuestMonitors)(&ulValue);
|
---|
645 | RTPrintf("Maximum guest monitor count: %u\n", ulValue);
|
---|
646 | systemProperties->COMGETTER(MinGuestCPUCount)(&ulValue);
|
---|
647 | RTPrintf("Minimum guest CPU count: %u\n", ulValue);
|
---|
648 | systemProperties->COMGETTER(MaxGuestCPUCount)(&ulValue);
|
---|
649 | RTPrintf("Maximum guest CPU count: %u\n", ulValue);
|
---|
650 | systemProperties->COMGETTER(InfoVDSize)(&i64Value);
|
---|
651 | RTPrintf("Virtual disk limit (info): %lld Bytes\n", i64Value);
|
---|
652 | systemProperties->COMGETTER(SerialPortCount)(&ulValue);
|
---|
653 | RTPrintf("Maximum Serial Port count: %u\n", ulValue);
|
---|
654 | systemProperties->COMGETTER(ParallelPortCount)(&ulValue);
|
---|
655 | RTPrintf("Maximum Parallel Port count: %u\n", ulValue);
|
---|
656 | systemProperties->COMGETTER(MaxBootPosition)(&ulValue);
|
---|
657 | RTPrintf("Maximum Boot Position: %u\n", ulValue);
|
---|
658 | systemProperties->GetMaxNetworkAdapters(ChipsetType_PIIX3, &ulValue);
|
---|
659 | RTPrintf("Maximum PIIX3 Network Adapter count: %u\n", ulValue);
|
---|
660 | systemProperties->GetMaxNetworkAdapters(ChipsetType_ICH9, &ulValue);
|
---|
661 | RTPrintf("Maximum ICH9 Network Adapter count: %u\n", ulValue);
|
---|
662 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_IDE, &ulValue);
|
---|
663 | RTPrintf("Maximum PIIX3 IDE Controllers: %u\n", ulValue);
|
---|
664 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_IDE, &ulValue);
|
---|
665 | RTPrintf("Maximum ICH9 IDE Controllers: %u\n", ulValue);
|
---|
666 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_IDE, &ulValue);
|
---|
667 | RTPrintf("Maximum IDE Port count: %u\n", ulValue);
|
---|
668 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_IDE, &ulValue);
|
---|
669 | RTPrintf("Maximum Devices per IDE Port: %u\n", ulValue);
|
---|
670 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SATA, &ulValue);
|
---|
671 | RTPrintf("Maximum PIIX3 SATA Controllers: %u\n", ulValue);
|
---|
672 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SATA, &ulValue);
|
---|
673 | RTPrintf("Maximum ICH9 SATA Controllers: %u\n", ulValue);
|
---|
674 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SATA, &ulValue);
|
---|
675 | RTPrintf("Maximum SATA Port count: %u\n", ulValue);
|
---|
676 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SATA, &ulValue);
|
---|
677 | RTPrintf("Maximum Devices per SATA Port: %u\n", ulValue);
|
---|
678 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SCSI, &ulValue);
|
---|
679 | RTPrintf("Maximum PIIX3 SCSI Controllers: %u\n", ulValue);
|
---|
680 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SCSI, &ulValue);
|
---|
681 | RTPrintf("Maximum ICH9 SCSI Controllers: %u\n", ulValue);
|
---|
682 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SCSI, &ulValue);
|
---|
683 | RTPrintf("Maximum SCSI Port count: %u\n", ulValue);
|
---|
684 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SCSI, &ulValue);
|
---|
685 | RTPrintf("Maximum Devices per SCSI Port: %u\n", ulValue);
|
---|
686 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SAS, &ulValue);
|
---|
687 | RTPrintf("Maximum SAS PIIX3 Controllers: %u\n", ulValue);
|
---|
688 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SAS, &ulValue);
|
---|
689 | RTPrintf("Maximum SAS ICH9 Controllers: %u\n", ulValue);
|
---|
690 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SAS, &ulValue);
|
---|
691 | RTPrintf("Maximum SAS Port count: %u\n", ulValue);
|
---|
692 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SAS, &ulValue);
|
---|
693 | RTPrintf("Maximum Devices per SAS Port: %u\n", ulValue);
|
---|
694 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_PCIe, &ulValue);
|
---|
695 | RTPrintf("Maximum NVMe PIIX3 Controllers: %u\n", ulValue);
|
---|
696 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_PCIe, &ulValue);
|
---|
697 | RTPrintf("Maximum NVMe ICH9 Controllers: %u\n", ulValue);
|
---|
698 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_PCIe, &ulValue);
|
---|
699 | RTPrintf("Maximum NVMe Port count: %u\n", ulValue);
|
---|
700 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_PCIe, &ulValue);
|
---|
701 | RTPrintf("Maximum Devices per NVMe Port: %u\n", ulValue);
|
---|
702 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_VirtioSCSI, &ulValue);
|
---|
703 | RTPrintf("Maximum virtio-scsi PIIX3 Controllers: %u\n", ulValue);
|
---|
704 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_VirtioSCSI, &ulValue);
|
---|
705 | RTPrintf("Maximum virtio-scsi ICH9 Controllers: %u\n", ulValue);
|
---|
706 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_VirtioSCSI, &ulValue);
|
---|
707 | RTPrintf("Maximum virtio-scsi Port count: %u\n", ulValue);
|
---|
708 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_VirtioSCSI, &ulValue);
|
---|
709 | RTPrintf("Maximum Devices per virtio-scsi Port: %u\n", ulValue);
|
---|
710 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_Floppy, &ulValue);
|
---|
711 | RTPrintf("Maximum PIIX3 Floppy Controllers:%u\n", ulValue);
|
---|
712 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_Floppy, &ulValue);
|
---|
713 | RTPrintf("Maximum ICH9 Floppy Controllers: %u\n", ulValue);
|
---|
714 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_Floppy, &ulValue);
|
---|
715 | RTPrintf("Maximum Floppy Port count: %u\n", ulValue);
|
---|
716 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_Floppy, &ulValue);
|
---|
717 | RTPrintf("Maximum Devices per Floppy Port: %u\n", ulValue);
|
---|
718 | #if 0
|
---|
719 | systemProperties->GetFreeDiskSpaceWarning(&i64Value);
|
---|
720 | RTPrintf("Free disk space warning at: %u Bytes\n", i64Value);
|
---|
721 | systemProperties->GetFreeDiskSpacePercentWarning(&ulValue);
|
---|
722 | RTPrintf("Free disk space warning at: %u %%\n", ulValue);
|
---|
723 | systemProperties->GetFreeDiskSpaceError(&i64Value);
|
---|
724 | RTPrintf("Free disk space error at: %u Bytes\n", i64Value);
|
---|
725 | systemProperties->GetFreeDiskSpacePercentError(&ulValue);
|
---|
726 | RTPrintf("Free disk space error at: %u %%\n", ulValue);
|
---|
727 | #endif
|
---|
728 | systemProperties->COMGETTER(DefaultMachineFolder)(str.asOutParam());
|
---|
729 | RTPrintf("Default machine folder: %ls\n", str.raw());
|
---|
730 | systemProperties->COMGETTER(RawModeSupported)(&fValue);
|
---|
731 | RTPrintf("Raw-mode Supported: %s\n", fValue ? "yes" : "no");
|
---|
732 | systemProperties->COMGETTER(ExclusiveHwVirt)(&fValue);
|
---|
733 | RTPrintf("Exclusive HW virtualization use: %s\n", fValue ? "on" : "off");
|
---|
734 | systemProperties->COMGETTER(DefaultHardDiskFormat)(str.asOutParam());
|
---|
735 | RTPrintf("Default hard disk format: %ls\n", str.raw());
|
---|
736 | systemProperties->COMGETTER(VRDEAuthLibrary)(str.asOutParam());
|
---|
737 | RTPrintf("VRDE auth library: %ls\n", str.raw());
|
---|
738 | systemProperties->COMGETTER(WebServiceAuthLibrary)(str.asOutParam());
|
---|
739 | RTPrintf("Webservice auth. library: %ls\n", str.raw());
|
---|
740 | systemProperties->COMGETTER(DefaultVRDEExtPack)(str.asOutParam());
|
---|
741 | RTPrintf("Remote desktop ExtPack: %ls\n", str.raw());
|
---|
742 | systemProperties->COMGETTER(LogHistoryCount)(&ulValue);
|
---|
743 | RTPrintf("Log history count: %u\n", ulValue);
|
---|
744 | systemProperties->COMGETTER(DefaultFrontend)(str.asOutParam());
|
---|
745 | RTPrintf("Default frontend: %ls\n", str.raw());
|
---|
746 | AudioDriverType_T enmAudio;
|
---|
747 | systemProperties->COMGETTER(DefaultAudioDriver)(&enmAudio);
|
---|
748 | switch (enmAudio)
|
---|
749 | {
|
---|
750 | case AudioDriverType_Null: psz = "Null"; break;
|
---|
751 | case AudioDriverType_WinMM: psz = "WinMM"; break;
|
---|
752 | case AudioDriverType_OSS: psz = "OSS"; break;
|
---|
753 | case AudioDriverType_ALSA: psz = "ALSA"; break;
|
---|
754 | case AudioDriverType_DirectSound: psz = "DirectSound"; break;
|
---|
755 | case AudioDriverType_CoreAudio: psz = "CoreAudio"; break;
|
---|
756 | case AudioDriverType_MMPM: psz = "MMPM"; break;
|
---|
757 | case AudioDriverType_Pulse: psz = "Pulse"; break;
|
---|
758 | case AudioDriverType_SolAudio: psz = "SolAudio"; break;
|
---|
759 | default: psz = "Unknown";
|
---|
760 | }
|
---|
761 | RTPrintf("Default audio driver: %s\n", psz);
|
---|
762 | systemProperties->COMGETTER(AutostartDatabasePath)(str.asOutParam());
|
---|
763 | RTPrintf("Autostart database path: %ls\n", str.raw());
|
---|
764 | systemProperties->COMGETTER(DefaultAdditionsISO)(str.asOutParam());
|
---|
765 | RTPrintf("Default Guest Additions ISO: %ls\n", str.raw());
|
---|
766 | systemProperties->COMGETTER(LoggingLevel)(str.asOutParam());
|
---|
767 | RTPrintf("Logging Level: %ls\n", str.raw());
|
---|
768 | ProxyMode_T enmProxyMode = (ProxyMode_T)42;
|
---|
769 | systemProperties->COMGETTER(ProxyMode)(&enmProxyMode);
|
---|
770 | psz = "Unknown";
|
---|
771 | switch (enmProxyMode)
|
---|
772 | {
|
---|
773 | case ProxyMode_System: psz = "System"; break;
|
---|
774 | case ProxyMode_NoProxy: psz = "NoProxy"; break;
|
---|
775 | case ProxyMode_Manual: psz = "Manual"; break;
|
---|
776 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
777 | case ProxyMode_32BitHack: break; /* Shut up compiler warnings. */
|
---|
778 | #endif
|
---|
779 | }
|
---|
780 | RTPrintf("Proxy Mode: %s\n", psz);
|
---|
781 | systemProperties->COMGETTER(ProxyURL)(str.asOutParam());
|
---|
782 | RTPrintf("Proxy URL: %ls\n", str.raw());
|
---|
783 | return S_OK;
|
---|
784 | }
|
---|
785 |
|
---|
786 |
|
---|
787 | /**
|
---|
788 | * Helper function for querying and displaying DHCP option for an adapter.
|
---|
789 | *
|
---|
790 | * @returns See produceList.
|
---|
791 | * @param pSrv Smart pointer to IDHCPServer.
|
---|
792 | * @param vmSlot String identifying the adapter, like '[vmname]:slot'
|
---|
793 | */
|
---|
794 | static HRESULT listVmSlotDhcpOptions(const ComPtr<IDHCPServer> pSrv, const Utf8Str& vmSlot)
|
---|
795 | {
|
---|
796 | RTCList<RTCString> lstParts = vmSlot.split(":");
|
---|
797 | if (lstParts.size() < 2)
|
---|
798 | return E_INVALIDARG;
|
---|
799 | if (lstParts[0].length() < 2 || !lstParts[0].startsWith("[") || !lstParts[0].endsWith("]"))
|
---|
800 | return E_INVALIDARG;
|
---|
801 | Bstr vmName(lstParts[0].substr(1, lstParts[0].length()-2));
|
---|
802 | ULONG uSlot = lstParts[1].toUInt32();
|
---|
803 | com::SafeArray<BSTR> options;
|
---|
804 | CHECK_ERROR2I_RET(pSrv, GetVmSlotOptions(vmName.raw(), uSlot, ComSafeArrayAsOutParam(options)), hrcCheck);
|
---|
805 | if (options.size())
|
---|
806 | RTPrintf("Options for NIC %d of '%ls':\n", uSlot + 1, vmName.raw());
|
---|
807 | for (size_t i = 0; i < options.size(); ++i)
|
---|
808 | RTPrintf(" %ls\n", options[i]);
|
---|
809 |
|
---|
810 | return S_OK;
|
---|
811 | }
|
---|
812 |
|
---|
813 |
|
---|
814 | /**
|
---|
815 | * List DHCP servers.
|
---|
816 | *
|
---|
817 | * @returns See produceList.
|
---|
818 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
819 | */
|
---|
820 | static HRESULT listDhcpServers(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
821 | {
|
---|
822 | HRESULT rc = S_OK;
|
---|
823 | com::SafeIfaceArray<IDHCPServer> svrs;
|
---|
824 | CHECK_ERROR_RET(pVirtualBox, COMGETTER(DHCPServers)(ComSafeArrayAsOutParam(svrs)), rc);
|
---|
825 | for (size_t i = 0; i < svrs.size(); ++i)
|
---|
826 | {
|
---|
827 | ComPtr<IDHCPServer> svr = svrs[i];
|
---|
828 | Bstr netName;
|
---|
829 | svr->COMGETTER(NetworkName)(netName.asOutParam());
|
---|
830 | RTPrintf("NetworkName: %ls\n", netName.raw());
|
---|
831 | Bstr ip;
|
---|
832 | svr->COMGETTER(IPAddress)(ip.asOutParam());
|
---|
833 | RTPrintf("IP: %ls\n", ip.raw());
|
---|
834 | Bstr netmask;
|
---|
835 | svr->COMGETTER(NetworkMask)(netmask.asOutParam());
|
---|
836 | RTPrintf("NetworkMask: %ls\n", netmask.raw());
|
---|
837 | Bstr lowerIp;
|
---|
838 | svr->COMGETTER(LowerIP)(lowerIp.asOutParam());
|
---|
839 | RTPrintf("lowerIPAddress: %ls\n", lowerIp.raw());
|
---|
840 | Bstr upperIp;
|
---|
841 | svr->COMGETTER(UpperIP)(upperIp.asOutParam());
|
---|
842 | RTPrintf("upperIPAddress: %ls\n", upperIp.raw());
|
---|
843 | BOOL fEnabled;
|
---|
844 | svr->COMGETTER(Enabled)(&fEnabled);
|
---|
845 | RTPrintf("Enabled: %s\n", fEnabled ? "Yes" : "No");
|
---|
846 | com::SafeArray<BSTR> globalOptions;
|
---|
847 | CHECK_ERROR_BREAK(svr, COMGETTER(GlobalOptions)(ComSafeArrayAsOutParam(globalOptions)));
|
---|
848 | if (globalOptions.size())
|
---|
849 | {
|
---|
850 | RTPrintf("Global options:\n");
|
---|
851 | for (size_t j = 0; j < globalOptions.size(); ++j)
|
---|
852 | RTPrintf(" %ls\n", globalOptions[j]);
|
---|
853 | }
|
---|
854 | com::SafeArray<BSTR> vmConfigs;
|
---|
855 | CHECK_ERROR_BREAK(svr, COMGETTER(VmConfigs)(ComSafeArrayAsOutParam(vmConfigs)));
|
---|
856 | for (size_t j = 0; j < vmConfigs.size(); ++j)
|
---|
857 | {
|
---|
858 | rc = listVmSlotDhcpOptions(svr, vmConfigs[j]);
|
---|
859 | if (FAILED(rc))
|
---|
860 | break;
|
---|
861 | }
|
---|
862 | RTPrintf("\n");
|
---|
863 | }
|
---|
864 |
|
---|
865 | return rc;
|
---|
866 | }
|
---|
867 |
|
---|
868 | /**
|
---|
869 | * List extension packs.
|
---|
870 | *
|
---|
871 | * @returns See produceList.
|
---|
872 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
873 | */
|
---|
874 | static HRESULT listExtensionPacks(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
875 | {
|
---|
876 | ComObjPtr<IExtPackManager> ptrExtPackMgr;
|
---|
877 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(ExtensionPackManager)(ptrExtPackMgr.asOutParam()), hrcCheck);
|
---|
878 |
|
---|
879 | SafeIfaceArray<IExtPack> extPacks;
|
---|
880 | CHECK_ERROR2I_RET(ptrExtPackMgr, COMGETTER(InstalledExtPacks)(ComSafeArrayAsOutParam(extPacks)), hrcCheck);
|
---|
881 | RTPrintf("Extension Packs: %u\n", extPacks.size());
|
---|
882 |
|
---|
883 | HRESULT hrc = S_OK;
|
---|
884 | for (size_t i = 0; i < extPacks.size(); i++)
|
---|
885 | {
|
---|
886 | /* Read all the properties. */
|
---|
887 | Bstr bstrName;
|
---|
888 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Name)(bstrName.asOutParam()), hrc = hrcCheck; bstrName.setNull());
|
---|
889 | Bstr bstrDesc;
|
---|
890 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Description)(bstrDesc.asOutParam()), hrc = hrcCheck; bstrDesc.setNull());
|
---|
891 | Bstr bstrVersion;
|
---|
892 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Version)(bstrVersion.asOutParam()), hrc = hrcCheck; bstrVersion.setNull());
|
---|
893 | ULONG uRevision;
|
---|
894 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Revision)(&uRevision), hrc = hrcCheck; uRevision = 0);
|
---|
895 | Bstr bstrEdition;
|
---|
896 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Edition)(bstrEdition.asOutParam()), hrc = hrcCheck; bstrEdition.setNull());
|
---|
897 | Bstr bstrVrdeModule;
|
---|
898 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(VRDEModule)(bstrVrdeModule.asOutParam()),hrc=hrcCheck; bstrVrdeModule.setNull());
|
---|
899 | BOOL fUsable;
|
---|
900 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Usable)(&fUsable), hrc = hrcCheck; fUsable = FALSE);
|
---|
901 | Bstr bstrWhy;
|
---|
902 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(WhyUnusable)(bstrWhy.asOutParam()), hrc = hrcCheck; bstrWhy.setNull());
|
---|
903 |
|
---|
904 | /* Display them. */
|
---|
905 | if (i)
|
---|
906 | RTPrintf("\n");
|
---|
907 | RTPrintf("Pack no.%2zu: %ls\n"
|
---|
908 | "Version: %ls\n"
|
---|
909 | "Revision: %u\n"
|
---|
910 | "Edition: %ls\n"
|
---|
911 | "Description: %ls\n"
|
---|
912 | "VRDE Module: %ls\n"
|
---|
913 | "Usable: %RTbool\n"
|
---|
914 | "Why unusable: %ls\n",
|
---|
915 | i, bstrName.raw(),
|
---|
916 | bstrVersion.raw(),
|
---|
917 | uRevision,
|
---|
918 | bstrEdition.raw(),
|
---|
919 | bstrDesc.raw(),
|
---|
920 | bstrVrdeModule.raw(),
|
---|
921 | fUsable != FALSE,
|
---|
922 | bstrWhy.raw());
|
---|
923 |
|
---|
924 | /* Query plugins and display them. */
|
---|
925 | }
|
---|
926 | return hrc;
|
---|
927 | }
|
---|
928 |
|
---|
929 |
|
---|
930 | /**
|
---|
931 | * List machine groups.
|
---|
932 | *
|
---|
933 | * @returns See produceList.
|
---|
934 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
935 | */
|
---|
936 | static HRESULT listGroups(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
937 | {
|
---|
938 | SafeArray<BSTR> groups;
|
---|
939 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(MachineGroups)(ComSafeArrayAsOutParam(groups)), hrcCheck);
|
---|
940 |
|
---|
941 | for (size_t i = 0; i < groups.size(); i++)
|
---|
942 | {
|
---|
943 | RTPrintf("\"%ls\"\n", groups[i]);
|
---|
944 | }
|
---|
945 | return S_OK;
|
---|
946 | }
|
---|
947 |
|
---|
948 |
|
---|
949 | /**
|
---|
950 | * List video capture devices.
|
---|
951 | *
|
---|
952 | * @returns See produceList.
|
---|
953 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
954 | */
|
---|
955 | static HRESULT listVideoInputDevices(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
956 | {
|
---|
957 | HRESULT rc;
|
---|
958 | ComPtr<IHost> host;
|
---|
959 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
960 | com::SafeIfaceArray<IHostVideoInputDevice> hostVideoInputDevices;
|
---|
961 | CHECK_ERROR(host, COMGETTER(VideoInputDevices)(ComSafeArrayAsOutParam(hostVideoInputDevices)));
|
---|
962 | RTPrintf("Video Input Devices: %u\n", hostVideoInputDevices.size());
|
---|
963 | for (size_t i = 0; i < hostVideoInputDevices.size(); ++i)
|
---|
964 | {
|
---|
965 | ComPtr<IHostVideoInputDevice> p = hostVideoInputDevices[i];
|
---|
966 | Bstr name;
|
---|
967 | p->COMGETTER(Name)(name.asOutParam());
|
---|
968 | Bstr path;
|
---|
969 | p->COMGETTER(Path)(path.asOutParam());
|
---|
970 | Bstr alias;
|
---|
971 | p->COMGETTER(Alias)(alias.asOutParam());
|
---|
972 | RTPrintf("%ls \"%ls\"\n%ls\n", alias.raw(), name.raw(), path.raw());
|
---|
973 | }
|
---|
974 | return rc;
|
---|
975 | }
|
---|
976 |
|
---|
977 | /**
|
---|
978 | * List supported screen shot formats.
|
---|
979 | *
|
---|
980 | * @returns See produceList.
|
---|
981 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
982 | */
|
---|
983 | static HRESULT listScreenShotFormats(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
984 | {
|
---|
985 | HRESULT rc = S_OK;
|
---|
986 | ComPtr<ISystemProperties> systemProperties;
|
---|
987 | CHECK_ERROR(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()));
|
---|
988 | com::SafeArray<BitmapFormat_T> formats;
|
---|
989 | CHECK_ERROR(systemProperties, COMGETTER(ScreenShotFormats)(ComSafeArrayAsOutParam(formats)));
|
---|
990 |
|
---|
991 | RTPrintf("Supported %d screen shot formats:\n", formats.size());
|
---|
992 | for (size_t i = 0; i < formats.size(); ++i)
|
---|
993 | {
|
---|
994 | uint32_t u32Format = (uint32_t)formats[i];
|
---|
995 | char szFormat[5];
|
---|
996 | szFormat[0] = RT_BYTE1(u32Format);
|
---|
997 | szFormat[1] = RT_BYTE2(u32Format);
|
---|
998 | szFormat[2] = RT_BYTE3(u32Format);
|
---|
999 | szFormat[3] = RT_BYTE4(u32Format);
|
---|
1000 | szFormat[4] = 0;
|
---|
1001 | RTPrintf(" BitmapFormat_%s (0x%08X)\n", szFormat, u32Format);
|
---|
1002 | }
|
---|
1003 | return rc;
|
---|
1004 | }
|
---|
1005 |
|
---|
1006 | /**
|
---|
1007 | * List available cloud providers.
|
---|
1008 | *
|
---|
1009 | * @returns See produceList.
|
---|
1010 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
1011 | */
|
---|
1012 | static HRESULT listCloudProviders(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
1013 | {
|
---|
1014 | HRESULT rc = S_OK;
|
---|
1015 | ComPtr<ICloudProviderManager> pCloudProviderManager;
|
---|
1016 | CHECK_ERROR(pVirtualBox, COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()));
|
---|
1017 | com::SafeIfaceArray<ICloudProvider> apCloudProviders;
|
---|
1018 | CHECK_ERROR(pCloudProviderManager, COMGETTER(Providers)(ComSafeArrayAsOutParam(apCloudProviders)));
|
---|
1019 |
|
---|
1020 | RTPrintf("Supported %d cloud providers:\n", apCloudProviders.size());
|
---|
1021 | for (size_t i = 0; i < apCloudProviders.size(); ++i)
|
---|
1022 | {
|
---|
1023 | ComPtr<ICloudProvider> pCloudProvider = apCloudProviders[i];
|
---|
1024 | Bstr bstrProviderName;
|
---|
1025 | pCloudProvider->COMGETTER(Name)(bstrProviderName.asOutParam());
|
---|
1026 | RTPrintf("Name: %ls\n", bstrProviderName.raw());
|
---|
1027 | pCloudProvider->COMGETTER(ShortName)(bstrProviderName.asOutParam());
|
---|
1028 | RTPrintf("Short Name: %ls\n", bstrProviderName.raw());
|
---|
1029 | Bstr bstrProviderID;
|
---|
1030 | pCloudProvider->COMGETTER(Id)(bstrProviderID.asOutParam());
|
---|
1031 | RTPrintf("GUID: %ls\n", bstrProviderID.raw());
|
---|
1032 |
|
---|
1033 | RTPrintf("\n");
|
---|
1034 | }
|
---|
1035 | return rc;
|
---|
1036 | }
|
---|
1037 |
|
---|
1038 |
|
---|
1039 | /**
|
---|
1040 | * List all available cloud profiles (by iterating over the cloud providers).
|
---|
1041 | *
|
---|
1042 | * @returns See produceList.
|
---|
1043 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
1044 | * @param fOptLong If true, list all profile properties.
|
---|
1045 | */
|
---|
1046 | static HRESULT listCloudProfiles(const ComPtr<IVirtualBox> pVirtualBox, bool fOptLong)
|
---|
1047 | {
|
---|
1048 | HRESULT rc = S_OK;
|
---|
1049 | ComPtr<ICloudProviderManager> pCloudProviderManager;
|
---|
1050 | CHECK_ERROR(pVirtualBox, COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()));
|
---|
1051 | com::SafeIfaceArray<ICloudProvider> apCloudProviders;
|
---|
1052 | CHECK_ERROR(pCloudProviderManager, COMGETTER(Providers)(ComSafeArrayAsOutParam(apCloudProviders)));
|
---|
1053 |
|
---|
1054 | for (size_t i = 0; i < apCloudProviders.size(); ++i)
|
---|
1055 | {
|
---|
1056 | ComPtr<ICloudProvider> pCloudProvider = apCloudProviders[i];
|
---|
1057 | com::SafeIfaceArray<ICloudProfile> apCloudProfiles;
|
---|
1058 | CHECK_ERROR(pCloudProvider, COMGETTER(Profiles)(ComSafeArrayAsOutParam(apCloudProfiles)));
|
---|
1059 | for (size_t j = 0; j < apCloudProfiles.size(); ++j)
|
---|
1060 | {
|
---|
1061 | ComPtr<ICloudProfile> pCloudProfile = apCloudProfiles[j];
|
---|
1062 | Bstr bstrProfileName;
|
---|
1063 | pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam());
|
---|
1064 | RTPrintf("Name: %ls\n", bstrProfileName.raw());
|
---|
1065 | Bstr bstrProviderID;
|
---|
1066 | pCloudProfile->COMGETTER(ProviderId)(bstrProviderID.asOutParam());
|
---|
1067 | RTPrintf("Provider GUID: %ls\n", bstrProviderID.raw());
|
---|
1068 |
|
---|
1069 | if (fOptLong)
|
---|
1070 | {
|
---|
1071 | com::SafeArray<BSTR> names;
|
---|
1072 | com::SafeArray<BSTR> values;
|
---|
1073 | pCloudProfile->GetProperties(Bstr().raw(), ComSafeArrayAsOutParam(names), ComSafeArrayAsOutParam(values));
|
---|
1074 | size_t cNames = names.size();
|
---|
1075 | size_t cValues = values.size();
|
---|
1076 | bool fFirst = true;
|
---|
1077 | for (size_t k = 0; k < cNames; k++)
|
---|
1078 | {
|
---|
1079 | Bstr value;
|
---|
1080 | if (k < cValues)
|
---|
1081 | value = values[k];
|
---|
1082 | RTPrintf("%s%ls=%ls\n",
|
---|
1083 | fFirst ? "Property: " : " ",
|
---|
1084 | names[k], value.raw());
|
---|
1085 | fFirst = false;
|
---|
1086 | }
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | RTPrintf("\n");
|
---|
1090 | }
|
---|
1091 | }
|
---|
1092 | return rc;
|
---|
1093 | }
|
---|
1094 |
|
---|
1095 |
|
---|
1096 | /**
|
---|
1097 | * The type of lists we can produce.
|
---|
1098 | */
|
---|
1099 | enum enmListType
|
---|
1100 | {
|
---|
1101 | kListNotSpecified = 1000,
|
---|
1102 | kListVMs,
|
---|
1103 | kListRunningVMs,
|
---|
1104 | kListOsTypes,
|
---|
1105 | kListHostDvds,
|
---|
1106 | kListHostFloppies,
|
---|
1107 | kListInternalNetworks,
|
---|
1108 | kListBridgedInterfaces,
|
---|
1109 | #if defined(VBOX_WITH_NETFLT)
|
---|
1110 | kListHostOnlyInterfaces,
|
---|
1111 | #endif
|
---|
1112 | kListHostCpuIDs,
|
---|
1113 | kListHostInfo,
|
---|
1114 | kListHddBackends,
|
---|
1115 | kListHdds,
|
---|
1116 | kListDvds,
|
---|
1117 | kListFloppies,
|
---|
1118 | kListUsbHost,
|
---|
1119 | kListUsbFilters,
|
---|
1120 | kListSystemProperties,
|
---|
1121 | kListDhcpServers,
|
---|
1122 | kListExtPacks,
|
---|
1123 | kListGroups,
|
---|
1124 | kListNatNetworks,
|
---|
1125 | kListVideoInputDevices,
|
---|
1126 | kListScreenShotFormats,
|
---|
1127 | kListCloudProviders,
|
---|
1128 | kListCloudProfiles,
|
---|
1129 | };
|
---|
1130 |
|
---|
1131 |
|
---|
1132 | /**
|
---|
1133 | * Produces the specified listing.
|
---|
1134 | *
|
---|
1135 | * @returns S_OK or some COM error code that has been reported in full.
|
---|
1136 | * @param enmList The list to produce.
|
---|
1137 | * @param fOptLong Long (@c true) or short list format.
|
---|
1138 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
1139 | */
|
---|
1140 | static HRESULT produceList(enum enmListType enmCommand, bool fOptLong, bool fOptSorted, const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
1141 | {
|
---|
1142 | HRESULT rc = S_OK;
|
---|
1143 | switch (enmCommand)
|
---|
1144 | {
|
---|
1145 | case kListNotSpecified:
|
---|
1146 | AssertFailed();
|
---|
1147 | return E_FAIL;
|
---|
1148 |
|
---|
1149 | case kListVMs:
|
---|
1150 | {
|
---|
1151 | /*
|
---|
1152 | * Get the list of all registered VMs
|
---|
1153 | */
|
---|
1154 | com::SafeIfaceArray<IMachine> machines;
|
---|
1155 | rc = pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
|
---|
1156 | if (SUCCEEDED(rc))
|
---|
1157 | {
|
---|
1158 | /*
|
---|
1159 | * Display it.
|
---|
1160 | */
|
---|
1161 | if (!fOptSorted)
|
---|
1162 | {
|
---|
1163 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
1164 | if (machines[i])
|
---|
1165 | rc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
1166 | }
|
---|
1167 | else
|
---|
1168 | {
|
---|
1169 | /*
|
---|
1170 | * Sort the list by name before displaying it.
|
---|
1171 | */
|
---|
1172 | std::vector<std::pair<com::Bstr, IMachine *> > sortedMachines;
|
---|
1173 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
1174 | {
|
---|
1175 | IMachine *pMachine = machines[i];
|
---|
1176 | if (pMachine) /* no idea why we need to do this... */
|
---|
1177 | {
|
---|
1178 | Bstr bstrName;
|
---|
1179 | pMachine->COMGETTER(Name)(bstrName.asOutParam());
|
---|
1180 | sortedMachines.push_back(std::pair<com::Bstr, IMachine *>(bstrName, pMachine));
|
---|
1181 | }
|
---|
1182 | }
|
---|
1183 |
|
---|
1184 | std::sort(sortedMachines.begin(), sortedMachines.end());
|
---|
1185 |
|
---|
1186 | for (size_t i = 0; i < sortedMachines.size(); ++i)
|
---|
1187 | rc = showVMInfo(pVirtualBox, sortedMachines[i].second, NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
1188 | }
|
---|
1189 | }
|
---|
1190 | break;
|
---|
1191 | }
|
---|
1192 |
|
---|
1193 | case kListRunningVMs:
|
---|
1194 | {
|
---|
1195 | /*
|
---|
1196 | * Get the list of all _running_ VMs
|
---|
1197 | */
|
---|
1198 | com::SafeIfaceArray<IMachine> machines;
|
---|
1199 | rc = pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
|
---|
1200 | com::SafeArray<MachineState_T> states;
|
---|
1201 | if (SUCCEEDED(rc))
|
---|
1202 | rc = pVirtualBox->GetMachineStates(ComSafeArrayAsInParam(machines), ComSafeArrayAsOutParam(states));
|
---|
1203 | if (SUCCEEDED(rc))
|
---|
1204 | {
|
---|
1205 | /*
|
---|
1206 | * Iterate through the collection
|
---|
1207 | */
|
---|
1208 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
1209 | {
|
---|
1210 | if (machines[i])
|
---|
1211 | {
|
---|
1212 | MachineState_T machineState = states[i];
|
---|
1213 | switch (machineState)
|
---|
1214 | {
|
---|
1215 | case MachineState_Running:
|
---|
1216 | case MachineState_Teleporting:
|
---|
1217 | case MachineState_LiveSnapshotting:
|
---|
1218 | case MachineState_Paused:
|
---|
1219 | case MachineState_TeleportingPausedVM:
|
---|
1220 | rc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
1221 | break;
|
---|
1222 | default: break; /* Shut up MSC */
|
---|
1223 | }
|
---|
1224 | }
|
---|
1225 | }
|
---|
1226 | }
|
---|
1227 | break;
|
---|
1228 | }
|
---|
1229 |
|
---|
1230 | case kListOsTypes:
|
---|
1231 | {
|
---|
1232 | com::SafeIfaceArray<IGuestOSType> coll;
|
---|
1233 | rc = pVirtualBox->COMGETTER(GuestOSTypes)(ComSafeArrayAsOutParam(coll));
|
---|
1234 | if (SUCCEEDED(rc))
|
---|
1235 | {
|
---|
1236 | /*
|
---|
1237 | * Iterate through the collection.
|
---|
1238 | */
|
---|
1239 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
1240 | {
|
---|
1241 | ComPtr<IGuestOSType> guestOS;
|
---|
1242 | guestOS = coll[i];
|
---|
1243 | Bstr guestId;
|
---|
1244 | guestOS->COMGETTER(Id)(guestId.asOutParam());
|
---|
1245 | RTPrintf("ID: %ls\n", guestId.raw());
|
---|
1246 | Bstr guestDescription;
|
---|
1247 | guestOS->COMGETTER(Description)(guestDescription.asOutParam());
|
---|
1248 | RTPrintf("Description: %ls\n", guestDescription.raw());
|
---|
1249 | Bstr familyId;
|
---|
1250 | guestOS->COMGETTER(FamilyId)(familyId.asOutParam());
|
---|
1251 | RTPrintf("Family ID: %ls\n", familyId.raw());
|
---|
1252 | Bstr familyDescription;
|
---|
1253 | guestOS->COMGETTER(FamilyDescription)(familyDescription.asOutParam());
|
---|
1254 | RTPrintf("Family Desc: %ls\n", familyDescription.raw());
|
---|
1255 | BOOL is64Bit;
|
---|
1256 | guestOS->COMGETTER(Is64Bit)(&is64Bit);
|
---|
1257 | RTPrintf("64 bit: %RTbool\n", is64Bit);
|
---|
1258 | RTPrintf("\n");
|
---|
1259 | }
|
---|
1260 | }
|
---|
1261 | break;
|
---|
1262 | }
|
---|
1263 |
|
---|
1264 | case kListHostDvds:
|
---|
1265 | {
|
---|
1266 | ComPtr<IHost> host;
|
---|
1267 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
1268 | com::SafeIfaceArray<IMedium> coll;
|
---|
1269 | CHECK_ERROR(host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
|
---|
1270 | if (SUCCEEDED(rc))
|
---|
1271 | {
|
---|
1272 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
1273 | {
|
---|
1274 | ComPtr<IMedium> dvdDrive = coll[i];
|
---|
1275 | Bstr uuid;
|
---|
1276 | dvdDrive->COMGETTER(Id)(uuid.asOutParam());
|
---|
1277 | RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
|
---|
1278 | Bstr location;
|
---|
1279 | dvdDrive->COMGETTER(Location)(location.asOutParam());
|
---|
1280 | RTPrintf("Name: %ls\n\n", location.raw());
|
---|
1281 | }
|
---|
1282 | }
|
---|
1283 | break;
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | case kListHostFloppies:
|
---|
1287 | {
|
---|
1288 | ComPtr<IHost> host;
|
---|
1289 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
1290 | com::SafeIfaceArray<IMedium> coll;
|
---|
1291 | CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(coll)));
|
---|
1292 | if (SUCCEEDED(rc))
|
---|
1293 | {
|
---|
1294 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
1295 | {
|
---|
1296 | ComPtr<IMedium> floppyDrive = coll[i];
|
---|
1297 | Bstr uuid;
|
---|
1298 | floppyDrive->COMGETTER(Id)(uuid.asOutParam());
|
---|
1299 | RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
|
---|
1300 | Bstr location;
|
---|
1301 | floppyDrive->COMGETTER(Location)(location.asOutParam());
|
---|
1302 | RTPrintf("Name: %ls\n\n", location.raw());
|
---|
1303 | }
|
---|
1304 | }
|
---|
1305 | break;
|
---|
1306 | }
|
---|
1307 |
|
---|
1308 | case kListInternalNetworks:
|
---|
1309 | rc = listInternalNetworks(pVirtualBox);
|
---|
1310 | break;
|
---|
1311 |
|
---|
1312 | case kListBridgedInterfaces:
|
---|
1313 | #if defined(VBOX_WITH_NETFLT)
|
---|
1314 | case kListHostOnlyInterfaces:
|
---|
1315 | #endif
|
---|
1316 | rc = listNetworkInterfaces(pVirtualBox, enmCommand == kListBridgedInterfaces);
|
---|
1317 | break;
|
---|
1318 |
|
---|
1319 | case kListHostInfo:
|
---|
1320 | rc = listHostInfo(pVirtualBox);
|
---|
1321 | break;
|
---|
1322 |
|
---|
1323 | case kListHostCpuIDs:
|
---|
1324 | {
|
---|
1325 | ComPtr<IHost> Host;
|
---|
1326 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(Host.asOutParam()));
|
---|
1327 |
|
---|
1328 | RTPrintf("Host CPUIDs:\n\nLeaf no. EAX EBX ECX EDX\n");
|
---|
1329 | ULONG uCpuNo = 0; /* ASSUMES that CPU#0 is online. */
|
---|
1330 | static uint32_t const s_auCpuIdRanges[] =
|
---|
1331 | {
|
---|
1332 | UINT32_C(0x00000000), UINT32_C(0x0000007f),
|
---|
1333 | UINT32_C(0x80000000), UINT32_C(0x8000007f),
|
---|
1334 | UINT32_C(0xc0000000), UINT32_C(0xc000007f)
|
---|
1335 | };
|
---|
1336 | for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
|
---|
1337 | {
|
---|
1338 | ULONG uEAX, uEBX, uECX, uEDX, cLeafs;
|
---|
1339 | CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, s_auCpuIdRanges[i], 0, &cLeafs, &uEBX, &uECX, &uEDX));
|
---|
1340 | if (cLeafs < s_auCpuIdRanges[i] || cLeafs > s_auCpuIdRanges[i+1])
|
---|
1341 | continue;
|
---|
1342 | cLeafs++;
|
---|
1343 | for (ULONG iLeaf = s_auCpuIdRanges[i]; iLeaf <= cLeafs; iLeaf++)
|
---|
1344 | {
|
---|
1345 | CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, iLeaf, 0, &uEAX, &uEBX, &uECX, &uEDX));
|
---|
1346 | RTPrintf("%08x %08x %08x %08x %08x\n", iLeaf, uEAX, uEBX, uECX, uEDX);
|
---|
1347 | }
|
---|
1348 | }
|
---|
1349 | break;
|
---|
1350 | }
|
---|
1351 |
|
---|
1352 | case kListHddBackends:
|
---|
1353 | rc = listHddBackends(pVirtualBox);
|
---|
1354 | break;
|
---|
1355 |
|
---|
1356 | case kListHdds:
|
---|
1357 | {
|
---|
1358 | com::SafeIfaceArray<IMedium> hdds;
|
---|
1359 | CHECK_ERROR(pVirtualBox, COMGETTER(HardDisks)(ComSafeArrayAsOutParam(hdds)));
|
---|
1360 | rc = listMedia(pVirtualBox, hdds, "base", fOptLong);
|
---|
1361 | break;
|
---|
1362 | }
|
---|
1363 |
|
---|
1364 | case kListDvds:
|
---|
1365 | {
|
---|
1366 | com::SafeIfaceArray<IMedium> dvds;
|
---|
1367 | CHECK_ERROR(pVirtualBox, COMGETTER(DVDImages)(ComSafeArrayAsOutParam(dvds)));
|
---|
1368 | rc = listMedia(pVirtualBox, dvds, NULL, fOptLong);
|
---|
1369 | break;
|
---|
1370 | }
|
---|
1371 |
|
---|
1372 | case kListFloppies:
|
---|
1373 | {
|
---|
1374 | com::SafeIfaceArray<IMedium> floppies;
|
---|
1375 | CHECK_ERROR(pVirtualBox, COMGETTER(FloppyImages)(ComSafeArrayAsOutParam(floppies)));
|
---|
1376 | rc = listMedia(pVirtualBox, floppies, NULL, fOptLong);
|
---|
1377 | break;
|
---|
1378 | }
|
---|
1379 |
|
---|
1380 | case kListUsbHost:
|
---|
1381 | rc = listUsbHost(pVirtualBox);
|
---|
1382 | break;
|
---|
1383 |
|
---|
1384 | case kListUsbFilters:
|
---|
1385 | rc = listUsbFilters(pVirtualBox);
|
---|
1386 | break;
|
---|
1387 |
|
---|
1388 | case kListSystemProperties:
|
---|
1389 | rc = listSystemProperties(pVirtualBox);
|
---|
1390 | break;
|
---|
1391 |
|
---|
1392 | case kListDhcpServers:
|
---|
1393 | rc = listDhcpServers(pVirtualBox);
|
---|
1394 | break;
|
---|
1395 |
|
---|
1396 | case kListExtPacks:
|
---|
1397 | rc = listExtensionPacks(pVirtualBox);
|
---|
1398 | break;
|
---|
1399 |
|
---|
1400 | case kListGroups:
|
---|
1401 | rc = listGroups(pVirtualBox);
|
---|
1402 | break;
|
---|
1403 |
|
---|
1404 | case kListNatNetworks:
|
---|
1405 | {
|
---|
1406 | com::SafeIfaceArray<INATNetwork> nets;
|
---|
1407 | CHECK_ERROR(pVirtualBox, COMGETTER(NATNetworks)(ComSafeArrayAsOutParam(nets)));
|
---|
1408 | for (size_t i = 0; i < nets.size(); ++i)
|
---|
1409 | {
|
---|
1410 | ComPtr<INATNetwork> net = nets[i];
|
---|
1411 | Bstr netName;
|
---|
1412 | net->COMGETTER(NetworkName)(netName.asOutParam());
|
---|
1413 | RTPrintf("NetworkName: %ls\n", netName.raw());
|
---|
1414 | Bstr gateway;
|
---|
1415 | net->COMGETTER(Gateway)(gateway.asOutParam());
|
---|
1416 | RTPrintf("IP: %ls\n", gateway.raw());
|
---|
1417 | Bstr network;
|
---|
1418 | net->COMGETTER(Network)(network.asOutParam());
|
---|
1419 | RTPrintf("Network: %ls\n", network.raw());
|
---|
1420 | BOOL fEnabled;
|
---|
1421 | net->COMGETTER(IPv6Enabled)(&fEnabled);
|
---|
1422 | RTPrintf("IPv6 Enabled: %s\n", fEnabled ? "Yes" : "No");
|
---|
1423 | Bstr ipv6prefix;
|
---|
1424 | net->COMGETTER(IPv6Prefix)(ipv6prefix.asOutParam());
|
---|
1425 | RTPrintf("IPv6 Prefix: %ls\n", ipv6prefix.raw());
|
---|
1426 | net->COMGETTER(NeedDhcpServer)(&fEnabled);
|
---|
1427 | RTPrintf("DHCP Enabled: %s\n", fEnabled ? "Yes" : "No");
|
---|
1428 | net->COMGETTER(Enabled)(&fEnabled);
|
---|
1429 | RTPrintf("Enabled: %s\n", fEnabled ? "Yes" : "No");
|
---|
1430 |
|
---|
1431 | #define PRINT_STRING_ARRAY(title) \
|
---|
1432 | if (strs.size() > 0) \
|
---|
1433 | { \
|
---|
1434 | RTPrintf(title); \
|
---|
1435 | size_t j = 0; \
|
---|
1436 | for (;j < strs.size(); ++j) \
|
---|
1437 | RTPrintf(" %s\n", Utf8Str(strs[j]).c_str()); \
|
---|
1438 | }
|
---|
1439 |
|
---|
1440 | com::SafeArray<BSTR> strs;
|
---|
1441 |
|
---|
1442 | CHECK_ERROR(nets[i], COMGETTER(PortForwardRules4)(ComSafeArrayAsOutParam(strs)));
|
---|
1443 | PRINT_STRING_ARRAY("Port-forwarding (ipv4)\n");
|
---|
1444 | strs.setNull();
|
---|
1445 |
|
---|
1446 | CHECK_ERROR(nets[i], COMGETTER(PortForwardRules6)(ComSafeArrayAsOutParam(strs)));
|
---|
1447 | PRINT_STRING_ARRAY("Port-forwarding (ipv6)\n");
|
---|
1448 | strs.setNull();
|
---|
1449 |
|
---|
1450 | CHECK_ERROR(nets[i], COMGETTER(LocalMappings)(ComSafeArrayAsOutParam(strs)));
|
---|
1451 | PRINT_STRING_ARRAY("loopback mappings (ipv4)\n");
|
---|
1452 | strs.setNull();
|
---|
1453 |
|
---|
1454 | #undef PRINT_STRING_ARRAY
|
---|
1455 | RTPrintf("\n");
|
---|
1456 | }
|
---|
1457 | break;
|
---|
1458 | }
|
---|
1459 |
|
---|
1460 | case kListVideoInputDevices:
|
---|
1461 | rc = listVideoInputDevices(pVirtualBox);
|
---|
1462 | break;
|
---|
1463 |
|
---|
1464 | case kListScreenShotFormats:
|
---|
1465 | rc = listScreenShotFormats(pVirtualBox);
|
---|
1466 | break;
|
---|
1467 |
|
---|
1468 | case kListCloudProviders:
|
---|
1469 | rc = listCloudProviders(pVirtualBox);
|
---|
1470 | break;
|
---|
1471 |
|
---|
1472 | case kListCloudProfiles:
|
---|
1473 | rc = listCloudProfiles(pVirtualBox, fOptLong);
|
---|
1474 | break;
|
---|
1475 |
|
---|
1476 | /* No default here, want gcc warnings. */
|
---|
1477 |
|
---|
1478 | } /* end switch */
|
---|
1479 |
|
---|
1480 | return rc;
|
---|
1481 | }
|
---|
1482 |
|
---|
1483 | /**
|
---|
1484 | * Handles the 'list' command.
|
---|
1485 | *
|
---|
1486 | * @returns Appropriate exit code.
|
---|
1487 | * @param a Handler argument.
|
---|
1488 | */
|
---|
1489 | RTEXITCODE handleList(HandlerArg *a)
|
---|
1490 | {
|
---|
1491 | bool fOptLong = false;
|
---|
1492 | bool fOptMultiple = false;
|
---|
1493 | bool fOptSorted = false;
|
---|
1494 | enum enmListType enmOptCommand = kListNotSpecified;
|
---|
1495 |
|
---|
1496 | static const RTGETOPTDEF s_aListOptions[] =
|
---|
1497 | {
|
---|
1498 | { "--long", 'l', RTGETOPT_REQ_NOTHING },
|
---|
1499 | { "--multiple", 'm', RTGETOPT_REQ_NOTHING }, /* not offical yet */
|
---|
1500 | { "--sorted", 's', RTGETOPT_REQ_NOTHING },
|
---|
1501 | { "vms", kListVMs, RTGETOPT_REQ_NOTHING },
|
---|
1502 | { "runningvms", kListRunningVMs, RTGETOPT_REQ_NOTHING },
|
---|
1503 | { "ostypes", kListOsTypes, RTGETOPT_REQ_NOTHING },
|
---|
1504 | { "hostdvds", kListHostDvds, RTGETOPT_REQ_NOTHING },
|
---|
1505 | { "hostfloppies", kListHostFloppies, RTGETOPT_REQ_NOTHING },
|
---|
1506 | { "intnets", kListInternalNetworks, RTGETOPT_REQ_NOTHING },
|
---|
1507 | { "hostifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING }, /* backward compatibility */
|
---|
1508 | { "bridgedifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING },
|
---|
1509 | #if defined(VBOX_WITH_NETFLT)
|
---|
1510 | { "hostonlyifs", kListHostOnlyInterfaces, RTGETOPT_REQ_NOTHING },
|
---|
1511 | #endif
|
---|
1512 | { "natnetworks", kListNatNetworks, RTGETOPT_REQ_NOTHING },
|
---|
1513 | { "natnets", kListNatNetworks, RTGETOPT_REQ_NOTHING },
|
---|
1514 | { "hostinfo", kListHostInfo, RTGETOPT_REQ_NOTHING },
|
---|
1515 | { "hostcpuids", kListHostCpuIDs, RTGETOPT_REQ_NOTHING },
|
---|
1516 | { "hddbackends", kListHddBackends, RTGETOPT_REQ_NOTHING },
|
---|
1517 | { "hdds", kListHdds, RTGETOPT_REQ_NOTHING },
|
---|
1518 | { "dvds", kListDvds, RTGETOPT_REQ_NOTHING },
|
---|
1519 | { "floppies", kListFloppies, RTGETOPT_REQ_NOTHING },
|
---|
1520 | { "usbhost", kListUsbHost, RTGETOPT_REQ_NOTHING },
|
---|
1521 | { "usbfilters", kListUsbFilters, RTGETOPT_REQ_NOTHING },
|
---|
1522 | { "systemproperties", kListSystemProperties, RTGETOPT_REQ_NOTHING },
|
---|
1523 | { "dhcpservers", kListDhcpServers, RTGETOPT_REQ_NOTHING },
|
---|
1524 | { "extpacks", kListExtPacks, RTGETOPT_REQ_NOTHING },
|
---|
1525 | { "groups", kListGroups, RTGETOPT_REQ_NOTHING },
|
---|
1526 | { "webcams", kListVideoInputDevices, RTGETOPT_REQ_NOTHING },
|
---|
1527 | { "screenshotformats", kListScreenShotFormats, RTGETOPT_REQ_NOTHING },
|
---|
1528 | { "cloudproviders", kListCloudProviders, RTGETOPT_REQ_NOTHING },
|
---|
1529 | { "cloudprofiles", kListCloudProfiles, RTGETOPT_REQ_NOTHING },
|
---|
1530 | };
|
---|
1531 |
|
---|
1532 | int ch;
|
---|
1533 | RTGETOPTUNION ValueUnion;
|
---|
1534 | RTGETOPTSTATE GetState;
|
---|
1535 | RTGetOptInit(&GetState, a->argc, a->argv, s_aListOptions, RT_ELEMENTS(s_aListOptions),
|
---|
1536 | 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
1537 | while ((ch = RTGetOpt(&GetState, &ValueUnion)))
|
---|
1538 | {
|
---|
1539 | switch (ch)
|
---|
1540 | {
|
---|
1541 | case 'l': /* --long */
|
---|
1542 | fOptLong = true;
|
---|
1543 | break;
|
---|
1544 |
|
---|
1545 | case 's':
|
---|
1546 | fOptSorted = true;
|
---|
1547 | break;
|
---|
1548 |
|
---|
1549 | case 'm':
|
---|
1550 | fOptMultiple = true;
|
---|
1551 | if (enmOptCommand == kListNotSpecified)
|
---|
1552 | break;
|
---|
1553 | ch = enmOptCommand;
|
---|
1554 | RT_FALL_THRU();
|
---|
1555 |
|
---|
1556 | case kListVMs:
|
---|
1557 | case kListRunningVMs:
|
---|
1558 | case kListOsTypes:
|
---|
1559 | case kListHostDvds:
|
---|
1560 | case kListHostFloppies:
|
---|
1561 | case kListInternalNetworks:
|
---|
1562 | case kListBridgedInterfaces:
|
---|
1563 | #if defined(VBOX_WITH_NETFLT)
|
---|
1564 | case kListHostOnlyInterfaces:
|
---|
1565 | #endif
|
---|
1566 | case kListHostInfo:
|
---|
1567 | case kListHostCpuIDs:
|
---|
1568 | case kListHddBackends:
|
---|
1569 | case kListHdds:
|
---|
1570 | case kListDvds:
|
---|
1571 | case kListFloppies:
|
---|
1572 | case kListUsbHost:
|
---|
1573 | case kListUsbFilters:
|
---|
1574 | case kListSystemProperties:
|
---|
1575 | case kListDhcpServers:
|
---|
1576 | case kListExtPacks:
|
---|
1577 | case kListGroups:
|
---|
1578 | case kListNatNetworks:
|
---|
1579 | case kListVideoInputDevices:
|
---|
1580 | case kListScreenShotFormats:
|
---|
1581 | case kListCloudProviders:
|
---|
1582 | case kListCloudProfiles:
|
---|
1583 | enmOptCommand = (enum enmListType)ch;
|
---|
1584 | if (fOptMultiple)
|
---|
1585 | {
|
---|
1586 | HRESULT hrc = produceList((enum enmListType)ch, fOptLong, fOptSorted, a->virtualBox);
|
---|
1587 | if (FAILED(hrc))
|
---|
1588 | return RTEXITCODE_FAILURE;
|
---|
1589 | }
|
---|
1590 | break;
|
---|
1591 |
|
---|
1592 | case VINF_GETOPT_NOT_OPTION:
|
---|
1593 | return errorSyntax(USAGE_LIST, "Unknown subcommand \"%s\".", ValueUnion.psz);
|
---|
1594 |
|
---|
1595 | default:
|
---|
1596 | return errorGetOpt(USAGE_LIST, ch, &ValueUnion);
|
---|
1597 | }
|
---|
1598 | }
|
---|
1599 |
|
---|
1600 | /*
|
---|
1601 | * If not in multiple list mode, we have to produce the list now.
|
---|
1602 | */
|
---|
1603 | if (enmOptCommand == kListNotSpecified)
|
---|
1604 | return errorSyntax(USAGE_LIST, "Missing subcommand for \"list\" command.\n");
|
---|
1605 | if (!fOptMultiple)
|
---|
1606 | {
|
---|
1607 | HRESULT hrc = produceList(enmOptCommand, fOptLong, fOptSorted, a->virtualBox);
|
---|
1608 | if (FAILED(hrc))
|
---|
1609 | return RTEXITCODE_FAILURE;
|
---|
1610 | }
|
---|
1611 |
|
---|
1612 | return RTEXITCODE_SUCCESS;
|
---|
1613 | }
|
---|
1614 |
|
---|
1615 | #endif /* !VBOX_ONLY_DOCS */
|
---|
1616 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|