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