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