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