1 | /* $Id: VBoxManageList.cpp 85579 2020-07-31 13:09:16Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - The 'list' command.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef VBOX_ONLY_DOCS
|
---|
19 |
|
---|
20 |
|
---|
21 | /*********************************************************************************************************************************
|
---|
22 | * Header Files *
|
---|
23 | *********************************************************************************************************************************/
|
---|
24 | #include <VBox/com/com.h>
|
---|
25 | #include <VBox/com/string.h>
|
---|
26 | #include <VBox/com/Guid.h>
|
---|
27 | #include <VBox/com/array.h>
|
---|
28 | #include <VBox/com/ErrorInfo.h>
|
---|
29 | #include <VBox/com/errorprint.h>
|
---|
30 |
|
---|
31 | #include <VBox/com/VirtualBox.h>
|
---|
32 |
|
---|
33 | #include <VBox/log.h>
|
---|
34 | #include <iprt/stream.h>
|
---|
35 | #include <iprt/string.h>
|
---|
36 | #include <iprt/time.h>
|
---|
37 | #include <iprt/getopt.h>
|
---|
38 | #include <iprt/ctype.h>
|
---|
39 |
|
---|
40 | #include <vector>
|
---|
41 | #include <algorithm>
|
---|
42 |
|
---|
43 | #include "VBoxManage.h"
|
---|
44 | using namespace com;
|
---|
45 |
|
---|
46 | #ifdef VBOX_WITH_HOSTNETIF_API
|
---|
47 | static const char *getHostIfMediumTypeText(HostNetworkInterfaceMediumType_T enmType)
|
---|
48 | {
|
---|
49 | switch (enmType)
|
---|
50 | {
|
---|
51 | case HostNetworkInterfaceMediumType_Ethernet: return "Ethernet";
|
---|
52 | case HostNetworkInterfaceMediumType_PPP: return "PPP";
|
---|
53 | case HostNetworkInterfaceMediumType_SLIP: return "SLIP";
|
---|
54 | case HostNetworkInterfaceMediumType_Unknown: return "Unknown";
|
---|
55 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
56 | case HostNetworkInterfaceMediumType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
57 | #endif
|
---|
58 | }
|
---|
59 | return "unknown";
|
---|
60 | }
|
---|
61 |
|
---|
62 | static const char *getHostIfStatusText(HostNetworkInterfaceStatus_T enmStatus)
|
---|
63 | {
|
---|
64 | switch (enmStatus)
|
---|
65 | {
|
---|
66 | case HostNetworkInterfaceStatus_Up: return "Up";
|
---|
67 | case HostNetworkInterfaceStatus_Down: return "Down";
|
---|
68 | case HostNetworkInterfaceStatus_Unknown: return "Unknown";
|
---|
69 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
70 | case HostNetworkInterfaceStatus_32BitHack: break; /* Shut up compiler warnings. */
|
---|
71 | #endif
|
---|
72 | }
|
---|
73 | return "unknown";
|
---|
74 | }
|
---|
75 | #endif /* VBOX_WITH_HOSTNETIF_API */
|
---|
76 |
|
---|
77 | static const char*getDeviceTypeText(DeviceType_T enmType)
|
---|
78 | {
|
---|
79 | switch (enmType)
|
---|
80 | {
|
---|
81 | case DeviceType_HardDisk: return "HardDisk";
|
---|
82 | case DeviceType_DVD: return "DVD";
|
---|
83 | case DeviceType_Floppy: return "Floppy";
|
---|
84 | /* Make MSC happy */
|
---|
85 | case DeviceType_Null: return "Null";
|
---|
86 | case DeviceType_Network: return "Network";
|
---|
87 | case DeviceType_USB: return "USB";
|
---|
88 | case DeviceType_SharedFolder: return "SharedFolder";
|
---|
89 | case DeviceType_Graphics3D: return "Graphics3D";
|
---|
90 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
91 | case DeviceType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
92 | #endif
|
---|
93 | }
|
---|
94 | return "Unknown";
|
---|
95 | }
|
---|
96 |
|
---|
97 |
|
---|
98 | /**
|
---|
99 | * List internal networks.
|
---|
100 | *
|
---|
101 | * @returns See produceList.
|
---|
102 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
103 | */
|
---|
104 | static HRESULT listInternalNetworks(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
105 | {
|
---|
106 | HRESULT rc;
|
---|
107 | com::SafeArray<BSTR> internalNetworks;
|
---|
108 | CHECK_ERROR(pVirtualBox, COMGETTER(InternalNetworks)(ComSafeArrayAsOutParam(internalNetworks)));
|
---|
109 | for (size_t i = 0; i < internalNetworks.size(); ++i)
|
---|
110 | {
|
---|
111 | RTPrintf("Name: %ls\n", internalNetworks[i]);
|
---|
112 | }
|
---|
113 | return rc;
|
---|
114 | }
|
---|
115 |
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * List network interfaces information (bridged/host only).
|
---|
119 | *
|
---|
120 | * @returns See produceList.
|
---|
121 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
122 | * @param fIsBridged Selects between listing host interfaces (for
|
---|
123 | * use with bridging) or host only interfaces.
|
---|
124 | */
|
---|
125 | static HRESULT listNetworkInterfaces(const ComPtr<IVirtualBox> pVirtualBox,
|
---|
126 | bool fIsBridged)
|
---|
127 | {
|
---|
128 | HRESULT rc;
|
---|
129 | ComPtr<IHost> host;
|
---|
130 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
131 | com::SafeIfaceArray<IHostNetworkInterface> hostNetworkInterfaces;
|
---|
132 | #if defined(VBOX_WITH_NETFLT)
|
---|
133 | if (fIsBridged)
|
---|
134 | CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_Bridged,
|
---|
135 | ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
136 | else
|
---|
137 | CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_HostOnly,
|
---|
138 | ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
139 | #else
|
---|
140 | RT_NOREF(fIsBridged);
|
---|
141 | CHECK_ERROR(host, COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
142 | #endif
|
---|
143 | for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i)
|
---|
144 | {
|
---|
145 | ComPtr<IHostNetworkInterface> networkInterface = hostNetworkInterfaces[i];
|
---|
146 | #ifndef VBOX_WITH_HOSTNETIF_API
|
---|
147 | Bstr interfaceName;
|
---|
148 | networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
|
---|
149 | RTPrintf("Name: %ls\n", interfaceName.raw());
|
---|
150 | Guid interfaceGuid;
|
---|
151 | networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
152 | RTPrintf("GUID: %ls\n\n", Bstr(interfaceGuid.toString()).raw());
|
---|
153 | #else /* VBOX_WITH_HOSTNETIF_API */
|
---|
154 | Bstr interfaceName;
|
---|
155 | networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
|
---|
156 | RTPrintf("Name: %ls\n", interfaceName.raw());
|
---|
157 | Bstr interfaceGuid;
|
---|
158 | networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
159 | RTPrintf("GUID: %ls\n", interfaceGuid.raw());
|
---|
160 | BOOL fDHCPEnabled = FALSE;
|
---|
161 | networkInterface->COMGETTER(DHCPEnabled)(&fDHCPEnabled);
|
---|
162 | RTPrintf("DHCP: %s\n", fDHCPEnabled ? "Enabled" : "Disabled");
|
---|
163 |
|
---|
164 | Bstr IPAddress;
|
---|
165 | networkInterface->COMGETTER(IPAddress)(IPAddress.asOutParam());
|
---|
166 | RTPrintf("IPAddress: %ls\n", IPAddress.raw());
|
---|
167 | Bstr NetworkMask;
|
---|
168 | networkInterface->COMGETTER(NetworkMask)(NetworkMask.asOutParam());
|
---|
169 | RTPrintf("NetworkMask: %ls\n", NetworkMask.raw());
|
---|
170 | Bstr IPV6Address;
|
---|
171 | networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam());
|
---|
172 | RTPrintf("IPV6Address: %ls\n", IPV6Address.raw());
|
---|
173 | ULONG IPV6NetworkMaskPrefixLength;
|
---|
174 | networkInterface->COMGETTER(IPV6NetworkMaskPrefixLength)(&IPV6NetworkMaskPrefixLength);
|
---|
175 | RTPrintf("IPV6NetworkMaskPrefixLength: %d\n", IPV6NetworkMaskPrefixLength);
|
---|
176 | Bstr HardwareAddress;
|
---|
177 | networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam());
|
---|
178 | RTPrintf("HardwareAddress: %ls\n", HardwareAddress.raw());
|
---|
179 | HostNetworkInterfaceMediumType_T Type;
|
---|
180 | networkInterface->COMGETTER(MediumType)(&Type);
|
---|
181 | RTPrintf("MediumType: %s\n", getHostIfMediumTypeText(Type));
|
---|
182 | BOOL fWireless = FALSE;
|
---|
183 | networkInterface->COMGETTER(Wireless)(&fWireless);
|
---|
184 | RTPrintf("Wireless: %s\n", fWireless ? "Yes" : "No");
|
---|
185 | HostNetworkInterfaceStatus_T Status;
|
---|
186 | networkInterface->COMGETTER(Status)(&Status);
|
---|
187 | RTPrintf("Status: %s\n", getHostIfStatusText(Status));
|
---|
188 | Bstr netName;
|
---|
189 | networkInterface->COMGETTER(NetworkName)(netName.asOutParam());
|
---|
190 | RTPrintf("VBoxNetworkName: %ls\n\n", netName.raw());
|
---|
191 | #endif
|
---|
192 | }
|
---|
193 | return rc;
|
---|
194 | }
|
---|
195 |
|
---|
196 |
|
---|
197 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
198 | /**
|
---|
199 | * List configured cloud network attachments.
|
---|
200 | *
|
---|
201 | * @returns See produceList.
|
---|
202 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
203 | * @param Reserved Placeholder!
|
---|
204 | */
|
---|
205 | static HRESULT listCloudNetworks(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
206 | {
|
---|
207 | HRESULT rc;
|
---|
208 | com::SafeIfaceArray<ICloudNetwork> cloudNetworks;
|
---|
209 | CHECK_ERROR(pVirtualBox, COMGETTER(CloudNetworks)(ComSafeArrayAsOutParam(cloudNetworks)));
|
---|
210 | for (size_t i = 0; i < cloudNetworks.size(); ++i)
|
---|
211 | {
|
---|
212 | ComPtr<ICloudNetwork> cloudNetwork = cloudNetworks[i];
|
---|
213 | Bstr networkName;
|
---|
214 | cloudNetwork->COMGETTER(NetworkName)(networkName.asOutParam());
|
---|
215 | RTPrintf("Name: %ls\n", networkName.raw());
|
---|
216 | // Guid interfaceGuid;
|
---|
217 | // cloudNetwork->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
218 | // RTPrintf("GUID: %ls\n\n", Bstr(interfaceGuid.toString()).raw());
|
---|
219 | BOOL fEnabled = FALSE;
|
---|
220 | cloudNetwork->COMGETTER(Enabled)(&fEnabled);
|
---|
221 | RTPrintf("State: %s\n", fEnabled ? "Enabled" : "Disabled");
|
---|
222 |
|
---|
223 | Bstr Provider;
|
---|
224 | cloudNetwork->COMGETTER(Provider)(Provider.asOutParam());
|
---|
225 | RTPrintf("CloudProvider: %ls\n", Provider.raw());
|
---|
226 | Bstr Profile;
|
---|
227 | cloudNetwork->COMGETTER(Profile)(Profile.asOutParam());
|
---|
228 | RTPrintf("CloudProfile: %ls\n", Profile.raw());
|
---|
229 | Bstr NetworkId;
|
---|
230 | cloudNetwork->COMGETTER(NetworkId)(NetworkId.asOutParam());
|
---|
231 | RTPrintf("CloudNetworkId: %ls\n", NetworkId.raw());
|
---|
232 | Bstr netName = BstrFmt("cloud-%ls", networkName.raw());
|
---|
233 | RTPrintf("VBoxNetworkName: %ls\n\n", netName.raw());
|
---|
234 | }
|
---|
235 | return rc;
|
---|
236 | }
|
---|
237 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
238 |
|
---|
239 |
|
---|
240 | /**
|
---|
241 | * List host information.
|
---|
242 | *
|
---|
243 | * @returns See produceList.
|
---|
244 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
245 | */
|
---|
246 | static HRESULT listHostInfo(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
247 | {
|
---|
248 | static struct
|
---|
249 | {
|
---|
250 | ProcessorFeature_T feature;
|
---|
251 | const char *pszName;
|
---|
252 | } features[]
|
---|
253 | =
|
---|
254 | {
|
---|
255 | { ProcessorFeature_HWVirtEx, "HW virtualization" },
|
---|
256 | { ProcessorFeature_PAE, "PAE" },
|
---|
257 | { ProcessorFeature_LongMode, "long mode" },
|
---|
258 | { ProcessorFeature_NestedPaging, "nested paging" },
|
---|
259 | { ProcessorFeature_UnrestrictedGuest, "unrestricted guest" },
|
---|
260 | { ProcessorFeature_NestedHWVirt, "nested HW virtualization" },
|
---|
261 | };
|
---|
262 | HRESULT rc;
|
---|
263 | ComPtr<IHost> Host;
|
---|
264 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(Host.asOutParam()));
|
---|
265 |
|
---|
266 | RTPrintf("Host Information:\n\n");
|
---|
267 |
|
---|
268 | LONG64 u64UtcTime = 0;
|
---|
269 | CHECK_ERROR(Host, COMGETTER(UTCTime)(&u64UtcTime));
|
---|
270 | RTTIMESPEC timeSpec;
|
---|
271 | char szTime[32];
|
---|
272 | RTPrintf("Host time: %s\n", RTTimeSpecToString(RTTimeSpecSetMilli(&timeSpec, u64UtcTime), szTime, sizeof(szTime)));
|
---|
273 |
|
---|
274 | ULONG processorOnlineCount = 0;
|
---|
275 | CHECK_ERROR(Host, COMGETTER(ProcessorOnlineCount)(&processorOnlineCount));
|
---|
276 | RTPrintf("Processor online count: %lu\n", processorOnlineCount);
|
---|
277 | ULONG processorCount = 0;
|
---|
278 | CHECK_ERROR(Host, COMGETTER(ProcessorCount)(&processorCount));
|
---|
279 | RTPrintf("Processor count: %lu\n", processorCount);
|
---|
280 | ULONG processorOnlineCoreCount = 0;
|
---|
281 | CHECK_ERROR(Host, COMGETTER(ProcessorOnlineCoreCount)(&processorOnlineCoreCount));
|
---|
282 | RTPrintf("Processor online core count: %lu\n", processorOnlineCoreCount);
|
---|
283 | ULONG processorCoreCount = 0;
|
---|
284 | CHECK_ERROR(Host, COMGETTER(ProcessorCoreCount)(&processorCoreCount));
|
---|
285 | RTPrintf("Processor core count: %lu\n", processorCoreCount);
|
---|
286 | for (unsigned i = 0; i < RT_ELEMENTS(features); i++)
|
---|
287 | {
|
---|
288 | BOOL supported;
|
---|
289 | CHECK_ERROR(Host, GetProcessorFeature(features[i].feature, &supported));
|
---|
290 | RTPrintf("Processor supports %s: %s\n", features[i].pszName, supported ? "yes" : "no");
|
---|
291 | }
|
---|
292 | for (ULONG i = 0; i < processorCount; i++)
|
---|
293 | {
|
---|
294 | ULONG processorSpeed = 0;
|
---|
295 | CHECK_ERROR(Host, GetProcessorSpeed(i, &processorSpeed));
|
---|
296 | if (processorSpeed)
|
---|
297 | RTPrintf("Processor#%u speed: %lu MHz\n", i, processorSpeed);
|
---|
298 | else
|
---|
299 | RTPrintf("Processor#%u speed: unknown\n", i);
|
---|
300 | Bstr processorDescription;
|
---|
301 | CHECK_ERROR(Host, GetProcessorDescription(i, processorDescription.asOutParam()));
|
---|
302 | RTPrintf("Processor#%u description: %ls\n", i, processorDescription.raw());
|
---|
303 | }
|
---|
304 |
|
---|
305 | ULONG memorySize = 0;
|
---|
306 | CHECK_ERROR(Host, COMGETTER(MemorySize)(&memorySize));
|
---|
307 | RTPrintf("Memory size: %lu MByte\n", memorySize);
|
---|
308 |
|
---|
309 | ULONG memoryAvailable = 0;
|
---|
310 | CHECK_ERROR(Host, COMGETTER(MemoryAvailable)(&memoryAvailable));
|
---|
311 | RTPrintf("Memory available: %lu MByte\n", memoryAvailable);
|
---|
312 |
|
---|
313 | Bstr operatingSystem;
|
---|
314 | CHECK_ERROR(Host, COMGETTER(OperatingSystem)(operatingSystem.asOutParam()));
|
---|
315 | RTPrintf("Operating system: %ls\n", operatingSystem.raw());
|
---|
316 |
|
---|
317 | Bstr oSVersion;
|
---|
318 | CHECK_ERROR(Host, COMGETTER(OSVersion)(oSVersion.asOutParam()));
|
---|
319 | RTPrintf("Operating system version: %ls\n", oSVersion.raw());
|
---|
320 | return rc;
|
---|
321 | }
|
---|
322 |
|
---|
323 |
|
---|
324 | /**
|
---|
325 | * List media information.
|
---|
326 | *
|
---|
327 | * @returns See produceList.
|
---|
328 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
329 | * @param aMedia Medium objects to list information for.
|
---|
330 | * @param pszParentUUIDStr String with the parent UUID string (or "base").
|
---|
331 | * @param fOptLong Long (@c true) or short list format.
|
---|
332 | */
|
---|
333 | static HRESULT listMedia(const ComPtr<IVirtualBox> pVirtualBox,
|
---|
334 | const com::SafeIfaceArray<IMedium> &aMedia,
|
---|
335 | const char *pszParentUUIDStr,
|
---|
336 | bool fOptLong)
|
---|
337 | {
|
---|
338 | HRESULT rc = S_OK;
|
---|
339 | for (size_t i = 0; i < aMedia.size(); ++i)
|
---|
340 | {
|
---|
341 | ComPtr<IMedium> pMedium = aMedia[i];
|
---|
342 |
|
---|
343 | rc = showMediumInfo(pVirtualBox, pMedium, pszParentUUIDStr, fOptLong);
|
---|
344 |
|
---|
345 | RTPrintf("\n");
|
---|
346 |
|
---|
347 | com::SafeIfaceArray<IMedium> children;
|
---|
348 | CHECK_ERROR(pMedium, COMGETTER(Children)(ComSafeArrayAsOutParam(children)));
|
---|
349 | if (children.size() > 0)
|
---|
350 | {
|
---|
351 | Bstr uuid;
|
---|
352 | pMedium->COMGETTER(Id)(uuid.asOutParam());
|
---|
353 |
|
---|
354 | // depth first listing of child media
|
---|
355 | rc = listMedia(pVirtualBox, children, Utf8Str(uuid).c_str(), fOptLong);
|
---|
356 | }
|
---|
357 | }
|
---|
358 |
|
---|
359 | return rc;
|
---|
360 | }
|
---|
361 |
|
---|
362 |
|
---|
363 | /**
|
---|
364 | * List virtual image backends.
|
---|
365 | *
|
---|
366 | * @returns See produceList.
|
---|
367 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
368 | */
|
---|
369 | static HRESULT listHddBackends(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
370 | {
|
---|
371 | HRESULT rc;
|
---|
372 | ComPtr<ISystemProperties> systemProperties;
|
---|
373 | CHECK_ERROR(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()));
|
---|
374 | com::SafeIfaceArray<IMediumFormat> mediumFormats;
|
---|
375 | CHECK_ERROR(systemProperties, COMGETTER(MediumFormats)(ComSafeArrayAsOutParam(mediumFormats)));
|
---|
376 |
|
---|
377 | RTPrintf("Supported hard disk backends:\n\n");
|
---|
378 | for (size_t i = 0; i < mediumFormats.size(); ++i)
|
---|
379 | {
|
---|
380 | /* General information */
|
---|
381 | Bstr id;
|
---|
382 | CHECK_ERROR(mediumFormats[i], COMGETTER(Id)(id.asOutParam()));
|
---|
383 |
|
---|
384 | Bstr description;
|
---|
385 | CHECK_ERROR(mediumFormats[i],
|
---|
386 | COMGETTER(Name)(description.asOutParam()));
|
---|
387 |
|
---|
388 | ULONG caps = 0;
|
---|
389 | com::SafeArray <MediumFormatCapabilities_T> mediumFormatCap;
|
---|
390 | CHECK_ERROR(mediumFormats[i],
|
---|
391 | COMGETTER(Capabilities)(ComSafeArrayAsOutParam(mediumFormatCap)));
|
---|
392 | for (ULONG j = 0; j < mediumFormatCap.size(); j++)
|
---|
393 | caps |= mediumFormatCap[j];
|
---|
394 |
|
---|
395 |
|
---|
396 | RTPrintf("Backend %u: id='%ls' description='%ls' capabilities=%#06x extensions='",
|
---|
397 | i, id.raw(), description.raw(), caps);
|
---|
398 |
|
---|
399 | /* File extensions */
|
---|
400 | com::SafeArray<BSTR> fileExtensions;
|
---|
401 | com::SafeArray<DeviceType_T> deviceTypes;
|
---|
402 | CHECK_ERROR(mediumFormats[i],
|
---|
403 | DescribeFileExtensions(ComSafeArrayAsOutParam(fileExtensions), ComSafeArrayAsOutParam(deviceTypes)));
|
---|
404 | for (size_t j = 0; j < fileExtensions.size(); ++j)
|
---|
405 | {
|
---|
406 | RTPrintf("%ls (%s)", Bstr(fileExtensions[j]).raw(), getDeviceTypeText(deviceTypes[j]));
|
---|
407 | if (j != fileExtensions.size()-1)
|
---|
408 | RTPrintf(",");
|
---|
409 | }
|
---|
410 | RTPrintf("'");
|
---|
411 |
|
---|
412 | /* Configuration keys */
|
---|
413 | com::SafeArray<BSTR> propertyNames;
|
---|
414 | com::SafeArray<BSTR> propertyDescriptions;
|
---|
415 | com::SafeArray<DataType_T> propertyTypes;
|
---|
416 | com::SafeArray<ULONG> propertyFlags;
|
---|
417 | com::SafeArray<BSTR> propertyDefaults;
|
---|
418 | CHECK_ERROR(mediumFormats[i],
|
---|
419 | DescribeProperties(ComSafeArrayAsOutParam(propertyNames),
|
---|
420 | ComSafeArrayAsOutParam(propertyDescriptions),
|
---|
421 | ComSafeArrayAsOutParam(propertyTypes),
|
---|
422 | ComSafeArrayAsOutParam(propertyFlags),
|
---|
423 | ComSafeArrayAsOutParam(propertyDefaults)));
|
---|
424 |
|
---|
425 | RTPrintf(" properties=(");
|
---|
426 | if (propertyNames.size() > 0)
|
---|
427 | {
|
---|
428 | for (size_t j = 0; j < propertyNames.size(); ++j)
|
---|
429 | {
|
---|
430 | RTPrintf("\n name='%ls' desc='%ls' type=",
|
---|
431 | Bstr(propertyNames[j]).raw(), Bstr(propertyDescriptions[j]).raw());
|
---|
432 | switch (propertyTypes[j])
|
---|
433 | {
|
---|
434 | case DataType_Int32: RTPrintf("int"); break;
|
---|
435 | case DataType_Int8: RTPrintf("byte"); break;
|
---|
436 | case DataType_String: RTPrintf("string"); break;
|
---|
437 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
438 | case DataType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
439 | #endif
|
---|
440 | }
|
---|
441 | RTPrintf(" flags=%#04x", propertyFlags[j]);
|
---|
442 | RTPrintf(" default='%ls'", Bstr(propertyDefaults[j]).raw());
|
---|
443 | if (j != propertyNames.size()-1)
|
---|
444 | RTPrintf(", ");
|
---|
445 | }
|
---|
446 | }
|
---|
447 | RTPrintf(")\n");
|
---|
448 | }
|
---|
449 | return rc;
|
---|
450 | }
|
---|
451 |
|
---|
452 |
|
---|
453 | /**
|
---|
454 | * List USB devices attached to the host.
|
---|
455 | *
|
---|
456 | * @returns See produceList.
|
---|
457 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
458 | */
|
---|
459 | static HRESULT listUsbHost(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
460 | {
|
---|
461 | HRESULT rc;
|
---|
462 | ComPtr<IHost> Host;
|
---|
463 | CHECK_ERROR_RET(pVirtualBox, COMGETTER(Host)(Host.asOutParam()), 1);
|
---|
464 |
|
---|
465 | SafeIfaceArray<IHostUSBDevice> CollPtr;
|
---|
466 | CHECK_ERROR_RET(Host, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(CollPtr)), 1);
|
---|
467 |
|
---|
468 | RTPrintf("Host USB Devices:\n\n");
|
---|
469 |
|
---|
470 | if (CollPtr.size() == 0)
|
---|
471 | {
|
---|
472 | RTPrintf("<none>\n\n");
|
---|
473 | }
|
---|
474 | else
|
---|
475 | {
|
---|
476 | for (size_t i = 0; i < CollPtr.size(); ++i)
|
---|
477 | {
|
---|
478 | ComPtr<IHostUSBDevice> dev = CollPtr[i];
|
---|
479 |
|
---|
480 | /* Query info. */
|
---|
481 | Bstr id;
|
---|
482 | CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), 1);
|
---|
483 | USHORT usVendorId;
|
---|
484 | CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), 1);
|
---|
485 | USHORT usProductId;
|
---|
486 | CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), 1);
|
---|
487 | USHORT bcdRevision;
|
---|
488 | CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), 1);
|
---|
489 | USHORT usPort;
|
---|
490 | CHECK_ERROR_RET(dev, COMGETTER(Port)(&usPort), 1);
|
---|
491 | USHORT usVersion;
|
---|
492 | CHECK_ERROR_RET(dev, COMGETTER(Version)(&usVersion), 1);
|
---|
493 | USBConnectionSpeed_T enmSpeed;
|
---|
494 | CHECK_ERROR_RET(dev, COMGETTER(Speed)(&enmSpeed), 1);
|
---|
495 |
|
---|
496 | RTPrintf("UUID: %s\n"
|
---|
497 | "VendorId: %#06x (%04X)\n"
|
---|
498 | "ProductId: %#06x (%04X)\n"
|
---|
499 | "Revision: %u.%u (%02u%02u)\n"
|
---|
500 | "Port: %u\n",
|
---|
501 | Utf8Str(id).c_str(),
|
---|
502 | usVendorId, usVendorId, usProductId, usProductId,
|
---|
503 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
504 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
505 | usPort);
|
---|
506 |
|
---|
507 | const char *pszSpeed = "?";
|
---|
508 | switch (enmSpeed)
|
---|
509 | {
|
---|
510 | case USBConnectionSpeed_Low:
|
---|
511 | pszSpeed = "Low";
|
---|
512 | break;
|
---|
513 | case USBConnectionSpeed_Full:
|
---|
514 | pszSpeed = "Full";
|
---|
515 | break;
|
---|
516 | case USBConnectionSpeed_High:
|
---|
517 | pszSpeed = "High";
|
---|
518 | break;
|
---|
519 | case USBConnectionSpeed_Super:
|
---|
520 | pszSpeed = "Super";
|
---|
521 | break;
|
---|
522 | case USBConnectionSpeed_SuperPlus:
|
---|
523 | pszSpeed = "SuperPlus";
|
---|
524 | break;
|
---|
525 | default:
|
---|
526 | ASSERT(false);
|
---|
527 | break;
|
---|
528 | }
|
---|
529 |
|
---|
530 | RTPrintf("USB version/speed: %u/%s\n", usVersion, pszSpeed);
|
---|
531 |
|
---|
532 | /* optional stuff. */
|
---|
533 | SafeArray<BSTR> CollDevInfo;
|
---|
534 | Bstr bstr;
|
---|
535 | CHECK_ERROR_RET(dev, COMGETTER(DeviceInfo)(ComSafeArrayAsOutParam(CollDevInfo)), 1);
|
---|
536 | if (CollDevInfo.size() >= 1)
|
---|
537 | bstr = Bstr(CollDevInfo[0]);
|
---|
538 | if (!bstr.isEmpty())
|
---|
539 | RTPrintf("Manufacturer: %ls\n", bstr.raw());
|
---|
540 | if (CollDevInfo.size() >= 2)
|
---|
541 | bstr = Bstr(CollDevInfo[1]);
|
---|
542 | if (!bstr.isEmpty())
|
---|
543 | RTPrintf("Product: %ls\n", bstr.raw());
|
---|
544 | CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
|
---|
545 | if (!bstr.isEmpty())
|
---|
546 | RTPrintf("SerialNumber: %ls\n", bstr.raw());
|
---|
547 | CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), 1);
|
---|
548 | if (!bstr.isEmpty())
|
---|
549 | RTPrintf("Address: %ls\n", bstr.raw());
|
---|
550 | CHECK_ERROR_RET(dev, COMGETTER(PortPath)(bstr.asOutParam()), 1);
|
---|
551 | if (!bstr.isEmpty())
|
---|
552 | RTPrintf("Port path: %ls\n", bstr.raw());
|
---|
553 |
|
---|
554 | /* current state */
|
---|
555 | USBDeviceState_T state;
|
---|
556 | CHECK_ERROR_RET(dev, COMGETTER(State)(&state), 1);
|
---|
557 | const char *pszState = "?";
|
---|
558 | switch (state)
|
---|
559 | {
|
---|
560 | case USBDeviceState_NotSupported:
|
---|
561 | pszState = "Not supported";
|
---|
562 | break;
|
---|
563 | case USBDeviceState_Unavailable:
|
---|
564 | pszState = "Unavailable";
|
---|
565 | break;
|
---|
566 | case USBDeviceState_Busy:
|
---|
567 | pszState = "Busy";
|
---|
568 | break;
|
---|
569 | case USBDeviceState_Available:
|
---|
570 | pszState = "Available";
|
---|
571 | break;
|
---|
572 | case USBDeviceState_Held:
|
---|
573 | pszState = "Held";
|
---|
574 | break;
|
---|
575 | case USBDeviceState_Captured:
|
---|
576 | pszState = "Captured";
|
---|
577 | break;
|
---|
578 | default:
|
---|
579 | ASSERT(false);
|
---|
580 | break;
|
---|
581 | }
|
---|
582 | RTPrintf("Current State: %s\n\n", pszState);
|
---|
583 | }
|
---|
584 | }
|
---|
585 | return rc;
|
---|
586 | }
|
---|
587 |
|
---|
588 |
|
---|
589 | /**
|
---|
590 | * List USB filters.
|
---|
591 | *
|
---|
592 | * @returns See produceList.
|
---|
593 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
594 | */
|
---|
595 | static HRESULT listUsbFilters(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
596 | {
|
---|
597 | HRESULT rc;
|
---|
598 |
|
---|
599 | RTPrintf("Global USB Device Filters:\n\n");
|
---|
600 |
|
---|
601 | ComPtr<IHost> host;
|
---|
602 | CHECK_ERROR_RET(pVirtualBox, COMGETTER(Host)(host.asOutParam()), 1);
|
---|
603 |
|
---|
604 | SafeIfaceArray<IHostUSBDeviceFilter> coll;
|
---|
605 | CHECK_ERROR_RET(host, COMGETTER(USBDeviceFilters)(ComSafeArrayAsOutParam(coll)), 1);
|
---|
606 |
|
---|
607 | if (coll.size() == 0)
|
---|
608 | {
|
---|
609 | RTPrintf("<none>\n\n");
|
---|
610 | }
|
---|
611 | else
|
---|
612 | {
|
---|
613 | for (size_t index = 0; index < coll.size(); ++index)
|
---|
614 | {
|
---|
615 | ComPtr<IHostUSBDeviceFilter> flt = coll[index];
|
---|
616 |
|
---|
617 | /* Query info. */
|
---|
618 |
|
---|
619 | RTPrintf("Index: %zu\n", index);
|
---|
620 |
|
---|
621 | BOOL active = FALSE;
|
---|
622 | CHECK_ERROR_RET(flt, COMGETTER(Active)(&active), 1);
|
---|
623 | RTPrintf("Active: %s\n", active ? "yes" : "no");
|
---|
624 |
|
---|
625 | USBDeviceFilterAction_T action;
|
---|
626 | CHECK_ERROR_RET(flt, COMGETTER(Action)(&action), 1);
|
---|
627 | const char *pszAction = "<invalid>";
|
---|
628 | switch (action)
|
---|
629 | {
|
---|
630 | case USBDeviceFilterAction_Ignore:
|
---|
631 | pszAction = "Ignore";
|
---|
632 | break;
|
---|
633 | case USBDeviceFilterAction_Hold:
|
---|
634 | pszAction = "Hold";
|
---|
635 | break;
|
---|
636 | default:
|
---|
637 | break;
|
---|
638 | }
|
---|
639 | RTPrintf("Action: %s\n", pszAction);
|
---|
640 |
|
---|
641 | Bstr bstr;
|
---|
642 | CHECK_ERROR_RET(flt, COMGETTER(Name)(bstr.asOutParam()), 1);
|
---|
643 | RTPrintf("Name: %ls\n", bstr.raw());
|
---|
644 | CHECK_ERROR_RET(flt, COMGETTER(VendorId)(bstr.asOutParam()), 1);
|
---|
645 | RTPrintf("VendorId: %ls\n", bstr.raw());
|
---|
646 | CHECK_ERROR_RET(flt, COMGETTER(ProductId)(bstr.asOutParam()), 1);
|
---|
647 | RTPrintf("ProductId: %ls\n", bstr.raw());
|
---|
648 | CHECK_ERROR_RET(flt, COMGETTER(Revision)(bstr.asOutParam()), 1);
|
---|
649 | RTPrintf("Revision: %ls\n", bstr.raw());
|
---|
650 | CHECK_ERROR_RET(flt, COMGETTER(Manufacturer)(bstr.asOutParam()), 1);
|
---|
651 | RTPrintf("Manufacturer: %ls\n", bstr.raw());
|
---|
652 | CHECK_ERROR_RET(flt, COMGETTER(Product)(bstr.asOutParam()), 1);
|
---|
653 | RTPrintf("Product: %ls\n", bstr.raw());
|
---|
654 | CHECK_ERROR_RET(flt, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
|
---|
655 | RTPrintf("Serial Number: %ls\n\n", bstr.raw());
|
---|
656 | }
|
---|
657 | }
|
---|
658 | return rc;
|
---|
659 | }
|
---|
660 |
|
---|
661 |
|
---|
662 | /**
|
---|
663 | * List system properties.
|
---|
664 | *
|
---|
665 | * @returns See produceList.
|
---|
666 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
667 | */
|
---|
668 | static HRESULT listSystemProperties(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
669 | {
|
---|
670 | ComPtr<ISystemProperties> systemProperties;
|
---|
671 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck);
|
---|
672 |
|
---|
673 | Bstr str;
|
---|
674 | ULONG ulValue;
|
---|
675 | LONG64 i64Value;
|
---|
676 | BOOL fValue;
|
---|
677 | const char *psz;
|
---|
678 |
|
---|
679 | pVirtualBox->COMGETTER(APIVersion)(str.asOutParam());
|
---|
680 | RTPrintf("API version: %ls\n", str.raw());
|
---|
681 |
|
---|
682 | systemProperties->COMGETTER(MinGuestRAM)(&ulValue);
|
---|
683 | RTPrintf("Minimum guest RAM size: %u Megabytes\n", ulValue);
|
---|
684 | systemProperties->COMGETTER(MaxGuestRAM)(&ulValue);
|
---|
685 | RTPrintf("Maximum guest RAM size: %u Megabytes\n", ulValue);
|
---|
686 | systemProperties->COMGETTER(MinGuestVRAM)(&ulValue);
|
---|
687 | RTPrintf("Minimum video RAM size: %u Megabytes\n", ulValue);
|
---|
688 | systemProperties->COMGETTER(MaxGuestVRAM)(&ulValue);
|
---|
689 | RTPrintf("Maximum video RAM size: %u Megabytes\n", ulValue);
|
---|
690 | systemProperties->COMGETTER(MaxGuestMonitors)(&ulValue);
|
---|
691 | RTPrintf("Maximum guest monitor count: %u\n", ulValue);
|
---|
692 | systemProperties->COMGETTER(MinGuestCPUCount)(&ulValue);
|
---|
693 | RTPrintf("Minimum guest CPU count: %u\n", ulValue);
|
---|
694 | systemProperties->COMGETTER(MaxGuestCPUCount)(&ulValue);
|
---|
695 | RTPrintf("Maximum guest CPU count: %u\n", ulValue);
|
---|
696 | systemProperties->COMGETTER(InfoVDSize)(&i64Value);
|
---|
697 | RTPrintf("Virtual disk limit (info): %lld Bytes\n", i64Value);
|
---|
698 | systemProperties->COMGETTER(SerialPortCount)(&ulValue);
|
---|
699 | RTPrintf("Maximum Serial Port count: %u\n", ulValue);
|
---|
700 | systemProperties->COMGETTER(ParallelPortCount)(&ulValue);
|
---|
701 | RTPrintf("Maximum Parallel Port count: %u\n", ulValue);
|
---|
702 | systemProperties->COMGETTER(MaxBootPosition)(&ulValue);
|
---|
703 | RTPrintf("Maximum Boot Position: %u\n", ulValue);
|
---|
704 | systemProperties->GetMaxNetworkAdapters(ChipsetType_PIIX3, &ulValue);
|
---|
705 | RTPrintf("Maximum PIIX3 Network Adapter count: %u\n", ulValue);
|
---|
706 | systemProperties->GetMaxNetworkAdapters(ChipsetType_ICH9, &ulValue);
|
---|
707 | RTPrintf("Maximum ICH9 Network Adapter count: %u\n", ulValue);
|
---|
708 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_IDE, &ulValue);
|
---|
709 | RTPrintf("Maximum PIIX3 IDE Controllers: %u\n", ulValue);
|
---|
710 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_IDE, &ulValue);
|
---|
711 | RTPrintf("Maximum ICH9 IDE Controllers: %u\n", ulValue);
|
---|
712 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_IDE, &ulValue);
|
---|
713 | RTPrintf("Maximum IDE Port count: %u\n", ulValue);
|
---|
714 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_IDE, &ulValue);
|
---|
715 | RTPrintf("Maximum Devices per IDE Port: %u\n", ulValue);
|
---|
716 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SATA, &ulValue);
|
---|
717 | RTPrintf("Maximum PIIX3 SATA Controllers: %u\n", ulValue);
|
---|
718 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SATA, &ulValue);
|
---|
719 | RTPrintf("Maximum ICH9 SATA Controllers: %u\n", ulValue);
|
---|
720 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SATA, &ulValue);
|
---|
721 | RTPrintf("Maximum SATA Port count: %u\n", ulValue);
|
---|
722 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SATA, &ulValue);
|
---|
723 | RTPrintf("Maximum Devices per SATA Port: %u\n", ulValue);
|
---|
724 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SCSI, &ulValue);
|
---|
725 | RTPrintf("Maximum PIIX3 SCSI Controllers: %u\n", ulValue);
|
---|
726 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SCSI, &ulValue);
|
---|
727 | RTPrintf("Maximum ICH9 SCSI Controllers: %u\n", ulValue);
|
---|
728 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SCSI, &ulValue);
|
---|
729 | RTPrintf("Maximum SCSI Port count: %u\n", ulValue);
|
---|
730 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SCSI, &ulValue);
|
---|
731 | RTPrintf("Maximum Devices per SCSI Port: %u\n", ulValue);
|
---|
732 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SAS, &ulValue);
|
---|
733 | RTPrintf("Maximum SAS PIIX3 Controllers: %u\n", ulValue);
|
---|
734 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SAS, &ulValue);
|
---|
735 | RTPrintf("Maximum SAS ICH9 Controllers: %u\n", ulValue);
|
---|
736 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SAS, &ulValue);
|
---|
737 | RTPrintf("Maximum SAS Port count: %u\n", ulValue);
|
---|
738 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SAS, &ulValue);
|
---|
739 | RTPrintf("Maximum Devices per SAS Port: %u\n", ulValue);
|
---|
740 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_PCIe, &ulValue);
|
---|
741 | RTPrintf("Maximum NVMe PIIX3 Controllers: %u\n", ulValue);
|
---|
742 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_PCIe, &ulValue);
|
---|
743 | RTPrintf("Maximum NVMe ICH9 Controllers: %u\n", ulValue);
|
---|
744 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_PCIe, &ulValue);
|
---|
745 | RTPrintf("Maximum NVMe Port count: %u\n", ulValue);
|
---|
746 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_PCIe, &ulValue);
|
---|
747 | RTPrintf("Maximum Devices per NVMe Port: %u\n", ulValue);
|
---|
748 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_VirtioSCSI, &ulValue);
|
---|
749 | RTPrintf("Maximum virtio-scsi PIIX3 Controllers: %u\n", ulValue);
|
---|
750 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_VirtioSCSI, &ulValue);
|
---|
751 | RTPrintf("Maximum virtio-scsi ICH9 Controllers: %u\n", ulValue);
|
---|
752 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_VirtioSCSI, &ulValue);
|
---|
753 | RTPrintf("Maximum virtio-scsi Port count: %u\n", ulValue);
|
---|
754 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_VirtioSCSI, &ulValue);
|
---|
755 | RTPrintf("Maximum Devices per virtio-scsi Port: %u\n", ulValue);
|
---|
756 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_Floppy, &ulValue);
|
---|
757 | RTPrintf("Maximum PIIX3 Floppy Controllers:%u\n", ulValue);
|
---|
758 | systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_Floppy, &ulValue);
|
---|
759 | RTPrintf("Maximum ICH9 Floppy Controllers: %u\n", ulValue);
|
---|
760 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_Floppy, &ulValue);
|
---|
761 | RTPrintf("Maximum Floppy Port count: %u\n", ulValue);
|
---|
762 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_Floppy, &ulValue);
|
---|
763 | RTPrintf("Maximum Devices per Floppy Port: %u\n", ulValue);
|
---|
764 | #if 0
|
---|
765 | systemProperties->GetFreeDiskSpaceWarning(&i64Value);
|
---|
766 | RTPrintf("Free disk space warning at: %u Bytes\n", i64Value);
|
---|
767 | systemProperties->GetFreeDiskSpacePercentWarning(&ulValue);
|
---|
768 | RTPrintf("Free disk space warning at: %u %%\n", ulValue);
|
---|
769 | systemProperties->GetFreeDiskSpaceError(&i64Value);
|
---|
770 | RTPrintf("Free disk space error at: %u Bytes\n", i64Value);
|
---|
771 | systemProperties->GetFreeDiskSpacePercentError(&ulValue);
|
---|
772 | RTPrintf("Free disk space error at: %u %%\n", ulValue);
|
---|
773 | #endif
|
---|
774 | systemProperties->COMGETTER(DefaultMachineFolder)(str.asOutParam());
|
---|
775 | RTPrintf("Default machine folder: %ls\n", str.raw());
|
---|
776 | systemProperties->COMGETTER(RawModeSupported)(&fValue);
|
---|
777 | RTPrintf("Raw-mode Supported: %s\n", fValue ? "yes" : "no");
|
---|
778 | systemProperties->COMGETTER(ExclusiveHwVirt)(&fValue);
|
---|
779 | RTPrintf("Exclusive HW virtualization use: %s\n", fValue ? "on" : "off");
|
---|
780 | systemProperties->COMGETTER(DefaultHardDiskFormat)(str.asOutParam());
|
---|
781 | RTPrintf("Default hard disk format: %ls\n", str.raw());
|
---|
782 | systemProperties->COMGETTER(VRDEAuthLibrary)(str.asOutParam());
|
---|
783 | RTPrintf("VRDE auth library: %ls\n", str.raw());
|
---|
784 | systemProperties->COMGETTER(WebServiceAuthLibrary)(str.asOutParam());
|
---|
785 | RTPrintf("Webservice auth. library: %ls\n", str.raw());
|
---|
786 | systemProperties->COMGETTER(DefaultVRDEExtPack)(str.asOutParam());
|
---|
787 | RTPrintf("Remote desktop ExtPack: %ls\n", str.raw());
|
---|
788 | systemProperties->COMGETTER(LogHistoryCount)(&ulValue);
|
---|
789 | RTPrintf("Log history count: %u\n", ulValue);
|
---|
790 | systemProperties->COMGETTER(DefaultFrontend)(str.asOutParam());
|
---|
791 | RTPrintf("Default frontend: %ls\n", str.raw());
|
---|
792 | AudioDriverType_T enmAudio;
|
---|
793 | systemProperties->COMGETTER(DefaultAudioDriver)(&enmAudio);
|
---|
794 | switch (enmAudio)
|
---|
795 | {
|
---|
796 | case AudioDriverType_Null: psz = "Null"; break;
|
---|
797 | case AudioDriverType_WinMM: psz = "WinMM"; break;
|
---|
798 | case AudioDriverType_OSS: psz = "OSS"; break;
|
---|
799 | case AudioDriverType_ALSA: psz = "ALSA"; break;
|
---|
800 | case AudioDriverType_DirectSound: psz = "DirectSound"; break;
|
---|
801 | case AudioDriverType_CoreAudio: psz = "CoreAudio"; break;
|
---|
802 | case AudioDriverType_MMPM: psz = "MMPM"; break;
|
---|
803 | case AudioDriverType_Pulse: psz = "Pulse"; break;
|
---|
804 | case AudioDriverType_SolAudio: psz = "SolAudio"; break;
|
---|
805 | default: psz = "Unknown";
|
---|
806 | }
|
---|
807 | RTPrintf("Default audio driver: %s\n", psz);
|
---|
808 | systemProperties->COMGETTER(AutostartDatabasePath)(str.asOutParam());
|
---|
809 | RTPrintf("Autostart database path: %ls\n", str.raw());
|
---|
810 | systemProperties->COMGETTER(DefaultAdditionsISO)(str.asOutParam());
|
---|
811 | RTPrintf("Default Guest Additions ISO: %ls\n", str.raw());
|
---|
812 | systemProperties->COMGETTER(LoggingLevel)(str.asOutParam());
|
---|
813 | RTPrintf("Logging Level: %ls\n", str.raw());
|
---|
814 | ProxyMode_T enmProxyMode = (ProxyMode_T)42;
|
---|
815 | systemProperties->COMGETTER(ProxyMode)(&enmProxyMode);
|
---|
816 | psz = "Unknown";
|
---|
817 | switch (enmProxyMode)
|
---|
818 | {
|
---|
819 | case ProxyMode_System: psz = "System"; break;
|
---|
820 | case ProxyMode_NoProxy: psz = "NoProxy"; break;
|
---|
821 | case ProxyMode_Manual: psz = "Manual"; break;
|
---|
822 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
823 | case ProxyMode_32BitHack: break; /* Shut up compiler warnings. */
|
---|
824 | #endif
|
---|
825 | }
|
---|
826 | RTPrintf("Proxy Mode: %s\n", psz);
|
---|
827 | systemProperties->COMGETTER(ProxyURL)(str.asOutParam());
|
---|
828 | RTPrintf("Proxy URL: %ls\n", str.raw());
|
---|
829 | return S_OK;
|
---|
830 | }
|
---|
831 |
|
---|
832 |
|
---|
833 | /**
|
---|
834 | * Helper for listDhcpServers() that shows a DHCP configuration.
|
---|
835 | */
|
---|
836 | static HRESULT showDhcpConfig(ComPtr<IDHCPConfig> ptrConfig)
|
---|
837 | {
|
---|
838 | HRESULT hrcRet = S_OK;
|
---|
839 |
|
---|
840 | ULONG secs = 0;
|
---|
841 | CHECK_ERROR2I_STMT(ptrConfig, COMGETTER(MinLeaseTime)(&secs), hrcRet = hrcCheck);
|
---|
842 | if (secs == 0)
|
---|
843 | RTPrintf(" minLeaseTime: default\n");
|
---|
844 | else
|
---|
845 | RTPrintf(" minLeaseTime: %u sec\n", secs);
|
---|
846 |
|
---|
847 | secs = 0;
|
---|
848 | CHECK_ERROR2I_STMT(ptrConfig, COMGETTER(DefaultLeaseTime)(&secs), hrcRet = hrcCheck);
|
---|
849 | if (secs == 0)
|
---|
850 | RTPrintf(" defaultLeaseTime: default\n");
|
---|
851 | else
|
---|
852 | RTPrintf(" defaultLeaseTime: %u sec\n", secs);
|
---|
853 |
|
---|
854 | secs = 0;
|
---|
855 | CHECK_ERROR2I_STMT(ptrConfig, COMGETTER(MaxLeaseTime)(&secs), hrcRet = hrcCheck);
|
---|
856 | if (secs == 0)
|
---|
857 | RTPrintf(" maxLeaseTime: default\n");
|
---|
858 | else
|
---|
859 | RTPrintf(" maxLeaseTime: %u sec\n", secs);
|
---|
860 |
|
---|
861 | com::SafeArray<DHCPOption_T> Options;
|
---|
862 | HRESULT hrc;
|
---|
863 | CHECK_ERROR2_STMT(hrc, ptrConfig, COMGETTER(ForcedOptions(ComSafeArrayAsOutParam(Options))), hrcRet = hrc);
|
---|
864 | if (FAILED(hrc))
|
---|
865 | RTPrintf(" Forced options: %Rhrc\n", hrc);
|
---|
866 | else if (Options.size() == 0)
|
---|
867 | RTPrintf(" Forced options: None\n");
|
---|
868 | else
|
---|
869 | {
|
---|
870 | RTPrintf(" Forced options: ");
|
---|
871 | for (size_t i = 0; i < Options.size(); i++)
|
---|
872 | RTPrintf(i ? ", %u" : "%u", Options[i]);
|
---|
873 | RTPrintf("\n");
|
---|
874 | }
|
---|
875 |
|
---|
876 | CHECK_ERROR2_STMT(hrc, ptrConfig, COMGETTER(SuppressedOptions(ComSafeArrayAsOutParam(Options))), hrcRet = hrc);
|
---|
877 | if (FAILED(hrc))
|
---|
878 | RTPrintf(" Suppressed opt.s: %Rhrc\n", hrc);
|
---|
879 | else if (Options.size() == 0)
|
---|
880 | RTPrintf(" Suppressed opts.: None\n");
|
---|
881 | else
|
---|
882 | {
|
---|
883 | RTPrintf(" Suppressed opts.: ");
|
---|
884 | for (size_t i = 0; i < Options.size(); i++)
|
---|
885 | RTPrintf(i ? ", %u" : "%u", Options[i]);
|
---|
886 | RTPrintf("\n");
|
---|
887 | }
|
---|
888 |
|
---|
889 | com::SafeArray<DHCPOptionEncoding_T> Encodings;
|
---|
890 | com::SafeArray<BSTR> Values;
|
---|
891 | CHECK_ERROR2_STMT(hrc, ptrConfig, GetAllOptions(ComSafeArrayAsOutParam(Options),
|
---|
892 | ComSafeArrayAsOutParam(Encodings),
|
---|
893 | ComSafeArrayAsOutParam(Values)), hrcRet = hrc);
|
---|
894 | if (FAILED(hrc))
|
---|
895 | RTPrintf(" DHCP options: %Rhrc\n", hrc);
|
---|
896 | else if (Options.size() != Encodings.size() || Options.size() != Values.size())
|
---|
897 | {
|
---|
898 | RTPrintf(" DHCP options: Return count mismatch: %zu, %zu, %zu\n", Options.size(), Encodings.size(), Values.size());
|
---|
899 | hrcRet = E_FAIL;
|
---|
900 | }
|
---|
901 | else if (Options.size() == 0)
|
---|
902 | RTPrintf(" DHCP options: None\n");
|
---|
903 | else
|
---|
904 | for (size_t i = 0; i < Options.size(); i++)
|
---|
905 | {
|
---|
906 | switch (Encodings[i])
|
---|
907 | {
|
---|
908 | case DHCPOptionEncoding_Normal:
|
---|
909 | RTPrintf(" %3d/legacy: %ls\n", Options[i], Values[i]);
|
---|
910 | break;
|
---|
911 | case DHCPOptionEncoding_Hex:
|
---|
912 | RTPrintf(" %3d/hex: %ls\n", Options[i], Values[i]);
|
---|
913 | break;
|
---|
914 | default:
|
---|
915 | RTPrintf(" %3d/%u?: %ls\n", Options[i], Encodings[i], Values[i]);
|
---|
916 | break;
|
---|
917 | }
|
---|
918 | }
|
---|
919 |
|
---|
920 | return S_OK;
|
---|
921 | }
|
---|
922 |
|
---|
923 |
|
---|
924 | /**
|
---|
925 | * List DHCP servers.
|
---|
926 | *
|
---|
927 | * @returns See produceList.
|
---|
928 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
929 | */
|
---|
930 | static HRESULT listDhcpServers(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
931 | {
|
---|
932 | HRESULT hrcRet = S_OK;
|
---|
933 | com::SafeIfaceArray<IDHCPServer> DHCPServers;
|
---|
934 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(DHCPServers)(ComSafeArrayAsOutParam(DHCPServers)), hrcCheck);
|
---|
935 | for (size_t i = 0; i < DHCPServers.size(); ++i)
|
---|
936 | {
|
---|
937 | if (i > 0)
|
---|
938 | RTPrintf("\n");
|
---|
939 |
|
---|
940 | ComPtr<IDHCPServer> ptrDHCPServer = DHCPServers[i];
|
---|
941 | Bstr bstr;
|
---|
942 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(NetworkName)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
943 | RTPrintf("NetworkName: %ls\n", bstr.raw());
|
---|
944 |
|
---|
945 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(IPAddress)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
946 | RTPrintf("Dhcpd IP: %ls\n", bstr.raw());
|
---|
947 |
|
---|
948 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(LowerIP)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
949 | RTPrintf("LowerIPAddress: %ls\n", bstr.raw());
|
---|
950 |
|
---|
951 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(UpperIP)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
952 | RTPrintf("UpperIPAddress: %ls\n", bstr.raw());
|
---|
953 |
|
---|
954 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(NetworkMask)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
955 | RTPrintf("NetworkMask: %ls\n", bstr.raw());
|
---|
956 |
|
---|
957 | BOOL fEnabled = FALSE;
|
---|
958 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(Enabled)(&fEnabled), hrcRet = hrcCheck);
|
---|
959 | RTPrintf("Enabled: %s\n", fEnabled ? "Yes" : "No");
|
---|
960 |
|
---|
961 | /* Global configuration: */
|
---|
962 | RTPrintf("Global Configuration:\n");
|
---|
963 | HRESULT hrc;
|
---|
964 | ComPtr<IDHCPGlobalConfig> ptrGlobal;
|
---|
965 | CHECK_ERROR2_STMT(hrc, ptrDHCPServer, COMGETTER(GlobalConfig)(ptrGlobal.asOutParam()), hrcRet = hrc);
|
---|
966 | if (SUCCEEDED(hrc))
|
---|
967 | {
|
---|
968 | hrc = showDhcpConfig(ptrGlobal);
|
---|
969 | if (FAILED(hrc))
|
---|
970 | hrcRet = hrc;
|
---|
971 | }
|
---|
972 |
|
---|
973 | /* Group configurations: */
|
---|
974 | com::SafeIfaceArray<IDHCPGroupConfig> Groups;
|
---|
975 | CHECK_ERROR2_STMT(hrc, ptrDHCPServer, COMGETTER(GroupConfigs)(ComSafeArrayAsOutParam(Groups)), hrcRet = hrc);
|
---|
976 | if (FAILED(hrc))
|
---|
977 | RTPrintf("Groups: %Rrc\n", hrc);
|
---|
978 | else if (Groups.size() == 0)
|
---|
979 | RTPrintf("Groups: None\n");
|
---|
980 | else
|
---|
981 | {
|
---|
982 | for (size_t iGrp = 0; iGrp < Groups.size(); iGrp++)
|
---|
983 | {
|
---|
984 | CHECK_ERROR2I_STMT(Groups[iGrp], COMGETTER(Name)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
985 | RTPrintf("Group: %ls\n", bstr.raw());
|
---|
986 |
|
---|
987 | com::SafeIfaceArray<IDHCPGroupCondition> Conditions;
|
---|
988 | CHECK_ERROR2_STMT(hrc, Groups[iGrp], COMGETTER(Conditions)(ComSafeArrayAsOutParam(Conditions)), hrcRet = hrc);
|
---|
989 | if (FAILED(hrc))
|
---|
990 | RTPrintf(" Conditions: %Rhrc\n", hrc);
|
---|
991 | else if (Conditions.size() == 0)
|
---|
992 | RTPrintf(" Conditions: None\n");
|
---|
993 | else
|
---|
994 | for (size_t iCond = 0; iCond < Conditions.size(); iCond++)
|
---|
995 | {
|
---|
996 | BOOL fInclusive = TRUE;
|
---|
997 | CHECK_ERROR2_STMT(hrc, Conditions[iCond], COMGETTER(Inclusive)(&fInclusive), hrcRet = hrc);
|
---|
998 | DHCPGroupConditionType_T enmType = DHCPGroupConditionType_MAC;
|
---|
999 | CHECK_ERROR2_STMT(hrc, Conditions[iCond], COMGETTER(Type)(&enmType), hrcRet = hrc);
|
---|
1000 | CHECK_ERROR2_STMT(hrc, Conditions[iCond], COMGETTER(Value)(bstr.asOutParam()), hrcRet = hrc);
|
---|
1001 |
|
---|
1002 | RTPrintf(" Conditions: %s %s %ls\n",
|
---|
1003 | fInclusive ? "include" : "exclude",
|
---|
1004 | enmType == DHCPGroupConditionType_MAC ? "MAC "
|
---|
1005 | : enmType == DHCPGroupConditionType_MACWildcard ? "MAC* "
|
---|
1006 | : enmType == DHCPGroupConditionType_vendorClassID ? "VendorCID "
|
---|
1007 | : enmType == DHCPGroupConditionType_vendorClassIDWildcard ? "VendorCID*"
|
---|
1008 | : enmType == DHCPGroupConditionType_userClassID ? "UserCID "
|
---|
1009 | : enmType == DHCPGroupConditionType_userClassIDWildcard ? "UserCID* "
|
---|
1010 | : "!UNKNOWN! ",
|
---|
1011 | bstr.raw());
|
---|
1012 | }
|
---|
1013 |
|
---|
1014 | hrc = showDhcpConfig(Groups[iGrp]);
|
---|
1015 | if (FAILED(hrc))
|
---|
1016 | hrcRet = hrc;
|
---|
1017 | }
|
---|
1018 | Groups.setNull();
|
---|
1019 | }
|
---|
1020 |
|
---|
1021 | /* Individual host / NIC configurations: */
|
---|
1022 | com::SafeIfaceArray<IDHCPIndividualConfig> Hosts;
|
---|
1023 | CHECK_ERROR2_STMT(hrc, ptrDHCPServer, COMGETTER(IndividualConfigs)(ComSafeArrayAsOutParam(Hosts)), hrcRet = hrc);
|
---|
1024 | if (FAILED(hrc))
|
---|
1025 | RTPrintf("Individual Configs: %Rrc\n", hrc);
|
---|
1026 | else if (Hosts.size() == 0)
|
---|
1027 | RTPrintf("Individual Configs: None\n");
|
---|
1028 | else
|
---|
1029 | {
|
---|
1030 | for (size_t iHost = 0; iHost < Hosts.size(); iHost++)
|
---|
1031 | {
|
---|
1032 | DHCPConfigScope_T enmScope = DHCPConfigScope_MAC;
|
---|
1033 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(Scope)(&enmScope), hrcRet = hrcCheck);
|
---|
1034 |
|
---|
1035 | if (enmScope == DHCPConfigScope_MAC)
|
---|
1036 | {
|
---|
1037 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(MACAddress)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
1038 | RTPrintf("Individual Config: MAC %ls\n", bstr.raw());
|
---|
1039 | }
|
---|
1040 | else
|
---|
1041 | {
|
---|
1042 | ULONG uSlot = 0;
|
---|
1043 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(Slot)(&uSlot), hrcRet = hrcCheck);
|
---|
1044 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(MachineId)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
1045 | Bstr bstrMACAddress;
|
---|
1046 | hrc = Hosts[iHost]->COMGETTER(MACAddress)(bstrMACAddress.asOutParam()); /* No CHECK_ERROR2 stuff! */
|
---|
1047 | if (SUCCEEDED(hrc))
|
---|
1048 | RTPrintf("Individual Config: VM NIC: %ls slot %u, MAC %ls\n", bstr.raw(), uSlot, bstrMACAddress.raw());
|
---|
1049 | else
|
---|
1050 | RTPrintf("Individual Config: VM NIC: %ls slot %u, MAC %Rhrc\n", bstr.raw(), uSlot, hrc);
|
---|
1051 | }
|
---|
1052 |
|
---|
1053 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(FixedAddress)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
1054 | if (bstr.isNotEmpty())
|
---|
1055 | RTPrintf(" Fixed Address: %ls\n", bstr.raw());
|
---|
1056 | else
|
---|
1057 | RTPrintf(" Fixed Address: dynamic\n");
|
---|
1058 |
|
---|
1059 | hrc = showDhcpConfig(Hosts[iHost]);
|
---|
1060 | if (FAILED(hrc))
|
---|
1061 | hrcRet = hrc;
|
---|
1062 | }
|
---|
1063 | Hosts.setNull();
|
---|
1064 | }
|
---|
1065 | }
|
---|
1066 |
|
---|
1067 | return hrcRet;
|
---|
1068 | }
|
---|
1069 |
|
---|
1070 | /**
|
---|
1071 | * List extension packs.
|
---|
1072 | *
|
---|
1073 | * @returns See produceList.
|
---|
1074 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
1075 | */
|
---|
1076 | static HRESULT listExtensionPacks(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
1077 | {
|
---|
1078 | ComObjPtr<IExtPackManager> ptrExtPackMgr;
|
---|
1079 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(ExtensionPackManager)(ptrExtPackMgr.asOutParam()), hrcCheck);
|
---|
1080 |
|
---|
1081 | SafeIfaceArray<IExtPack> extPacks;
|
---|
1082 | CHECK_ERROR2I_RET(ptrExtPackMgr, COMGETTER(InstalledExtPacks)(ComSafeArrayAsOutParam(extPacks)), hrcCheck);
|
---|
1083 | RTPrintf("Extension Packs: %u\n", extPacks.size());
|
---|
1084 |
|
---|
1085 | HRESULT hrc = S_OK;
|
---|
1086 | for (size_t i = 0; i < extPacks.size(); i++)
|
---|
1087 | {
|
---|
1088 | /* Read all the properties. */
|
---|
1089 | Bstr bstrName;
|
---|
1090 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Name)(bstrName.asOutParam()), hrc = hrcCheck; bstrName.setNull());
|
---|
1091 | Bstr bstrDesc;
|
---|
1092 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Description)(bstrDesc.asOutParam()), hrc = hrcCheck; bstrDesc.setNull());
|
---|
1093 | Bstr bstrVersion;
|
---|
1094 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Version)(bstrVersion.asOutParam()), hrc = hrcCheck; bstrVersion.setNull());
|
---|
1095 | ULONG uRevision;
|
---|
1096 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Revision)(&uRevision), hrc = hrcCheck; uRevision = 0);
|
---|
1097 | Bstr bstrEdition;
|
---|
1098 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Edition)(bstrEdition.asOutParam()), hrc = hrcCheck; bstrEdition.setNull());
|
---|
1099 | Bstr bstrVrdeModule;
|
---|
1100 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(VRDEModule)(bstrVrdeModule.asOutParam()),hrc=hrcCheck; bstrVrdeModule.setNull());
|
---|
1101 | BOOL fUsable;
|
---|
1102 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Usable)(&fUsable), hrc = hrcCheck; fUsable = FALSE);
|
---|
1103 | Bstr bstrWhy;
|
---|
1104 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(WhyUnusable)(bstrWhy.asOutParam()), hrc = hrcCheck; bstrWhy.setNull());
|
---|
1105 |
|
---|
1106 | /* Display them. */
|
---|
1107 | if (i)
|
---|
1108 | RTPrintf("\n");
|
---|
1109 | RTPrintf("Pack no.%2zu: %ls\n"
|
---|
1110 | "Version: %ls\n"
|
---|
1111 | "Revision: %u\n"
|
---|
1112 | "Edition: %ls\n"
|
---|
1113 | "Description: %ls\n"
|
---|
1114 | "VRDE Module: %ls\n"
|
---|
1115 | "Usable: %RTbool\n"
|
---|
1116 | "Why unusable: %ls\n",
|
---|
1117 | i, bstrName.raw(),
|
---|
1118 | bstrVersion.raw(),
|
---|
1119 | uRevision,
|
---|
1120 | bstrEdition.raw(),
|
---|
1121 | bstrDesc.raw(),
|
---|
1122 | bstrVrdeModule.raw(),
|
---|
1123 | fUsable != FALSE,
|
---|
1124 | bstrWhy.raw());
|
---|
1125 |
|
---|
1126 | /* Query plugins and display them. */
|
---|
1127 | }
|
---|
1128 | return hrc;
|
---|
1129 | }
|
---|
1130 |
|
---|
1131 |
|
---|
1132 | /**
|
---|
1133 | * List machine groups.
|
---|
1134 | *
|
---|
1135 | * @returns See produceList.
|
---|
1136 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
1137 | */
|
---|
1138 | static HRESULT listGroups(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
1139 | {
|
---|
1140 | SafeArray<BSTR> groups;
|
---|
1141 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(MachineGroups)(ComSafeArrayAsOutParam(groups)), hrcCheck);
|
---|
1142 |
|
---|
1143 | for (size_t i = 0; i < groups.size(); i++)
|
---|
1144 | {
|
---|
1145 | RTPrintf("\"%ls\"\n", groups[i]);
|
---|
1146 | }
|
---|
1147 | return S_OK;
|
---|
1148 | }
|
---|
1149 |
|
---|
1150 |
|
---|
1151 | /**
|
---|
1152 | * List video capture devices.
|
---|
1153 | *
|
---|
1154 | * @returns See produceList.
|
---|
1155 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
1156 | */
|
---|
1157 | static HRESULT listVideoInputDevices(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
1158 | {
|
---|
1159 | HRESULT rc;
|
---|
1160 | ComPtr<IHost> host;
|
---|
1161 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
1162 | com::SafeIfaceArray<IHostVideoInputDevice> hostVideoInputDevices;
|
---|
1163 | CHECK_ERROR(host, COMGETTER(VideoInputDevices)(ComSafeArrayAsOutParam(hostVideoInputDevices)));
|
---|
1164 | RTPrintf("Video Input Devices: %u\n", hostVideoInputDevices.size());
|
---|
1165 | for (size_t i = 0; i < hostVideoInputDevices.size(); ++i)
|
---|
1166 | {
|
---|
1167 | ComPtr<IHostVideoInputDevice> p = hostVideoInputDevices[i];
|
---|
1168 | Bstr name;
|
---|
1169 | p->COMGETTER(Name)(name.asOutParam());
|
---|
1170 | Bstr path;
|
---|
1171 | p->COMGETTER(Path)(path.asOutParam());
|
---|
1172 | Bstr alias;
|
---|
1173 | p->COMGETTER(Alias)(alias.asOutParam());
|
---|
1174 | RTPrintf("%ls \"%ls\"\n%ls\n", alias.raw(), name.raw(), path.raw());
|
---|
1175 | }
|
---|
1176 | return rc;
|
---|
1177 | }
|
---|
1178 |
|
---|
1179 | /**
|
---|
1180 | * List supported screen shot formats.
|
---|
1181 | *
|
---|
1182 | * @returns See produceList.
|
---|
1183 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
1184 | */
|
---|
1185 | static HRESULT listScreenShotFormats(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
1186 | {
|
---|
1187 | HRESULT rc = S_OK;
|
---|
1188 | ComPtr<ISystemProperties> systemProperties;
|
---|
1189 | CHECK_ERROR(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()));
|
---|
1190 | com::SafeArray<BitmapFormat_T> formats;
|
---|
1191 | CHECK_ERROR(systemProperties, COMGETTER(ScreenShotFormats)(ComSafeArrayAsOutParam(formats)));
|
---|
1192 |
|
---|
1193 | RTPrintf("Supported %d screen shot formats:\n", formats.size());
|
---|
1194 | for (size_t i = 0; i < formats.size(); ++i)
|
---|
1195 | {
|
---|
1196 | uint32_t u32Format = (uint32_t)formats[i];
|
---|
1197 | char szFormat[5];
|
---|
1198 | szFormat[0] = RT_BYTE1(u32Format);
|
---|
1199 | szFormat[1] = RT_BYTE2(u32Format);
|
---|
1200 | szFormat[2] = RT_BYTE3(u32Format);
|
---|
1201 | szFormat[3] = RT_BYTE4(u32Format);
|
---|
1202 | szFormat[4] = 0;
|
---|
1203 | RTPrintf(" BitmapFormat_%s (0x%08X)\n", szFormat, u32Format);
|
---|
1204 | }
|
---|
1205 | return rc;
|
---|
1206 | }
|
---|
1207 |
|
---|
1208 | /**
|
---|
1209 | * List available cloud providers.
|
---|
1210 | *
|
---|
1211 | * @returns See produceList.
|
---|
1212 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
1213 | */
|
---|
1214 | static HRESULT listCloudProviders(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
1215 | {
|
---|
1216 | HRESULT rc = S_OK;
|
---|
1217 | ComPtr<ICloudProviderManager> pCloudProviderManager;
|
---|
1218 | CHECK_ERROR(pVirtualBox, COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()));
|
---|
1219 | com::SafeIfaceArray<ICloudProvider> apCloudProviders;
|
---|
1220 | CHECK_ERROR(pCloudProviderManager, COMGETTER(Providers)(ComSafeArrayAsOutParam(apCloudProviders)));
|
---|
1221 |
|
---|
1222 | RTPrintf("Supported %d cloud providers:\n", apCloudProviders.size());
|
---|
1223 | for (size_t i = 0; i < apCloudProviders.size(); ++i)
|
---|
1224 | {
|
---|
1225 | ComPtr<ICloudProvider> pCloudProvider = apCloudProviders[i];
|
---|
1226 | Bstr bstrProviderName;
|
---|
1227 | pCloudProvider->COMGETTER(Name)(bstrProviderName.asOutParam());
|
---|
1228 | RTPrintf("Name: %ls\n", bstrProviderName.raw());
|
---|
1229 | pCloudProvider->COMGETTER(ShortName)(bstrProviderName.asOutParam());
|
---|
1230 | RTPrintf("Short Name: %ls\n", bstrProviderName.raw());
|
---|
1231 | Bstr bstrProviderID;
|
---|
1232 | pCloudProvider->COMGETTER(Id)(bstrProviderID.asOutParam());
|
---|
1233 | RTPrintf("GUID: %ls\n", bstrProviderID.raw());
|
---|
1234 |
|
---|
1235 | RTPrintf("\n");
|
---|
1236 | }
|
---|
1237 | return rc;
|
---|
1238 | }
|
---|
1239 |
|
---|
1240 |
|
---|
1241 | /**
|
---|
1242 | * List all available cloud profiles (by iterating over the cloud providers).
|
---|
1243 | *
|
---|
1244 | * @returns See produceList.
|
---|
1245 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
1246 | * @param fOptLong If true, list all profile properties.
|
---|
1247 | */
|
---|
1248 | static HRESULT listCloudProfiles(const ComPtr<IVirtualBox> &pVirtualBox, bool fOptLong)
|
---|
1249 | {
|
---|
1250 | HRESULT rc = S_OK;
|
---|
1251 | ComPtr<ICloudProviderManager> pCloudProviderManager;
|
---|
1252 | CHECK_ERROR(pVirtualBox, COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()));
|
---|
1253 | com::SafeIfaceArray<ICloudProvider> apCloudProviders;
|
---|
1254 | CHECK_ERROR(pCloudProviderManager, COMGETTER(Providers)(ComSafeArrayAsOutParam(apCloudProviders)));
|
---|
1255 |
|
---|
1256 | for (size_t i = 0; i < apCloudProviders.size(); ++i)
|
---|
1257 | {
|
---|
1258 | ComPtr<ICloudProvider> pCloudProvider = apCloudProviders[i];
|
---|
1259 | com::SafeIfaceArray<ICloudProfile> apCloudProfiles;
|
---|
1260 | CHECK_ERROR(pCloudProvider, COMGETTER(Profiles)(ComSafeArrayAsOutParam(apCloudProfiles)));
|
---|
1261 | for (size_t j = 0; j < apCloudProfiles.size(); ++j)
|
---|
1262 | {
|
---|
1263 | ComPtr<ICloudProfile> pCloudProfile = apCloudProfiles[j];
|
---|
1264 | Bstr bstrProfileName;
|
---|
1265 | pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam());
|
---|
1266 | RTPrintf("Name: %ls\n", bstrProfileName.raw());
|
---|
1267 | Bstr bstrProviderID;
|
---|
1268 | pCloudProfile->COMGETTER(ProviderId)(bstrProviderID.asOutParam());
|
---|
1269 | RTPrintf("Provider GUID: %ls\n", bstrProviderID.raw());
|
---|
1270 |
|
---|
1271 | if (fOptLong)
|
---|
1272 | {
|
---|
1273 | com::SafeArray<BSTR> names;
|
---|
1274 | com::SafeArray<BSTR> values;
|
---|
1275 | pCloudProfile->GetProperties(Bstr().raw(), ComSafeArrayAsOutParam(names), ComSafeArrayAsOutParam(values));
|
---|
1276 | size_t cNames = names.size();
|
---|
1277 | size_t cValues = values.size();
|
---|
1278 | bool fFirst = true;
|
---|
1279 | for (size_t k = 0; k < cNames; k++)
|
---|
1280 | {
|
---|
1281 | Bstr value;
|
---|
1282 | if (k < cValues)
|
---|
1283 | value = values[k];
|
---|
1284 | RTPrintf("%s%ls=%ls\n",
|
---|
1285 | fFirst ? "Property: " : " ",
|
---|
1286 | names[k], value.raw());
|
---|
1287 | fFirst = false;
|
---|
1288 | }
|
---|
1289 | }
|
---|
1290 |
|
---|
1291 | RTPrintf("\n");
|
---|
1292 | }
|
---|
1293 | }
|
---|
1294 | return rc;
|
---|
1295 | }
|
---|
1296 |
|
---|
1297 | static HRESULT displayCPUProfile(ICPUProfile *pProfile, size_t idx, int cchIdx, bool fOptLong, HRESULT hrc)
|
---|
1298 | {
|
---|
1299 | /* Retrieve the attributes needed for both long and short display. */
|
---|
1300 | Bstr bstrName;
|
---|
1301 | CHECK_ERROR2I_RET(pProfile, COMGETTER(Name)(bstrName.asOutParam()), hrcCheck);
|
---|
1302 |
|
---|
1303 | CPUArchitecture_T enmArchitecture = CPUArchitecture_Any;
|
---|
1304 | CHECK_ERROR2I_RET(pProfile, COMGETTER(Architecture)(&enmArchitecture), hrcCheck);
|
---|
1305 | const char *pszArchitecture = "???";
|
---|
1306 | switch (enmArchitecture)
|
---|
1307 | {
|
---|
1308 | case CPUArchitecture_x86: pszArchitecture = "x86"; break;
|
---|
1309 | case CPUArchitecture_AMD64: pszArchitecture = "AMD64"; break;
|
---|
1310 |
|
---|
1311 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
1312 | case CPUArchitecture_32BitHack:
|
---|
1313 | #endif
|
---|
1314 | case CPUArchitecture_Any:
|
---|
1315 | break;
|
---|
1316 | }
|
---|
1317 |
|
---|
1318 | /* Print what we've got. */
|
---|
1319 | if (!fOptLong)
|
---|
1320 | RTPrintf("#%0*zu: %ls [%s]\n", cchIdx, idx, bstrName.raw(), pszArchitecture);
|
---|
1321 | else
|
---|
1322 | {
|
---|
1323 | RTPrintf("CPU Profile #%02zu:\n", idx);
|
---|
1324 | RTPrintf(" Architecture: %s\n", pszArchitecture);
|
---|
1325 | RTPrintf(" Name: %ls\n", bstrName.raw());
|
---|
1326 | CHECK_ERROR2I_RET(pProfile, COMGETTER(FullName)(bstrName.asOutParam()), hrcCheck);
|
---|
1327 | RTPrintf(" Full Name: %ls\n", bstrName.raw());
|
---|
1328 | }
|
---|
1329 | return hrc;
|
---|
1330 | }
|
---|
1331 |
|
---|
1332 |
|
---|
1333 | /**
|
---|
1334 | * List all CPU profiles.
|
---|
1335 | *
|
---|
1336 | * @returns See produceList.
|
---|
1337 | * @param ptrVirtualBox Reference to the smart IVirtualBox pointer.
|
---|
1338 | * @param fOptLong If true, list all profile properties.
|
---|
1339 | * @param fOptSorted Sort the output if true, otherwise display in
|
---|
1340 | * system order.
|
---|
1341 | */
|
---|
1342 | static HRESULT listCPUProfiles(const ComPtr<IVirtualBox> &ptrVirtualBox, bool fOptLong, bool fOptSorted)
|
---|
1343 | {
|
---|
1344 | ComPtr<ISystemProperties> ptrSysProps;
|
---|
1345 | CHECK_ERROR2I_RET(ptrVirtualBox, COMGETTER(SystemProperties)(ptrSysProps.asOutParam()), hrcCheck);
|
---|
1346 | com::SafeIfaceArray<ICPUProfile> aCPUProfiles;
|
---|
1347 | CHECK_ERROR2I_RET(ptrSysProps, GetCPUProfiles(CPUArchitecture_Any, Bstr().raw(),
|
---|
1348 | ComSafeArrayAsOutParam(aCPUProfiles)), hrcCheck);
|
---|
1349 |
|
---|
1350 | int const cchIdx = 1 + (aCPUProfiles.size() >= 10) + (aCPUProfiles.size() >= 100);
|
---|
1351 |
|
---|
1352 | HRESULT hrc = S_OK;
|
---|
1353 | if (!fOptSorted)
|
---|
1354 | for (size_t i = 0; i < aCPUProfiles.size(); i++)
|
---|
1355 | hrc = displayCPUProfile(aCPUProfiles[i], i, cchIdx, fOptLong, hrc);
|
---|
1356 | else
|
---|
1357 | {
|
---|
1358 | std::vector<std::pair<com::Bstr, ICPUProfile *> > vecSortedProfiles;
|
---|
1359 | for (size_t i = 0; i < aCPUProfiles.size(); ++i)
|
---|
1360 | {
|
---|
1361 | Bstr bstrName;
|
---|
1362 | CHECK_ERROR2I_RET(aCPUProfiles[i], COMGETTER(Name)(bstrName.asOutParam()), hrcCheck);
|
---|
1363 | try
|
---|
1364 | {
|
---|
1365 | vecSortedProfiles.push_back(std::pair<com::Bstr, ICPUProfile *>(bstrName, aCPUProfiles[i]));
|
---|
1366 | }
|
---|
1367 | catch (std::bad_alloc &)
|
---|
1368 | {
|
---|
1369 | return E_OUTOFMEMORY;
|
---|
1370 | }
|
---|
1371 | }
|
---|
1372 |
|
---|
1373 | std::sort(vecSortedProfiles.begin(), vecSortedProfiles.end());
|
---|
1374 |
|
---|
1375 | for (size_t i = 0; i < vecSortedProfiles.size(); i++)
|
---|
1376 | hrc = displayCPUProfile(vecSortedProfiles[i].second, i, cchIdx, fOptLong, hrc);
|
---|
1377 | }
|
---|
1378 |
|
---|
1379 | return hrc;
|
---|
1380 | }
|
---|
1381 |
|
---|
1382 |
|
---|
1383 | /**
|
---|
1384 | * The type of lists we can produce.
|
---|
1385 | */
|
---|
1386 | enum ListType_T
|
---|
1387 | {
|
---|
1388 | kListNotSpecified = 1000,
|
---|
1389 | kListVMs,
|
---|
1390 | kListRunningVMs,
|
---|
1391 | kListOsTypes,
|
---|
1392 | kListHostDvds,
|
---|
1393 | kListHostFloppies,
|
---|
1394 | kListInternalNetworks,
|
---|
1395 | kListBridgedInterfaces,
|
---|
1396 | #if defined(VBOX_WITH_NETFLT)
|
---|
1397 | kListHostOnlyInterfaces,
|
---|
1398 | #endif
|
---|
1399 | #if defined(VBOX_WITH_CLOUD_NET)
|
---|
1400 | kListCloudNetworks,
|
---|
1401 | #endif
|
---|
1402 | kListHostCpuIDs,
|
---|
1403 | kListHostInfo,
|
---|
1404 | kListHddBackends,
|
---|
1405 | kListHdds,
|
---|
1406 | kListDvds,
|
---|
1407 | kListFloppies,
|
---|
1408 | kListUsbHost,
|
---|
1409 | kListUsbFilters,
|
---|
1410 | kListSystemProperties,
|
---|
1411 | kListDhcpServers,
|
---|
1412 | kListExtPacks,
|
---|
1413 | kListGroups,
|
---|
1414 | kListNatNetworks,
|
---|
1415 | kListVideoInputDevices,
|
---|
1416 | kListScreenShotFormats,
|
---|
1417 | kListCloudProviders,
|
---|
1418 | kListCloudProfiles,
|
---|
1419 | kListCPUProfiles
|
---|
1420 | };
|
---|
1421 |
|
---|
1422 |
|
---|
1423 | /**
|
---|
1424 | * Produces the specified listing.
|
---|
1425 | *
|
---|
1426 | * @returns S_OK or some COM error code that has been reported in full.
|
---|
1427 | * @param enmList The list to produce.
|
---|
1428 | * @param fOptLong Long (@c true) or short list format.
|
---|
1429 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
1430 | */
|
---|
1431 | static HRESULT produceList(enum ListType_T enmCommand, bool fOptLong, bool fOptSorted, const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
1432 | {
|
---|
1433 | HRESULT rc = S_OK;
|
---|
1434 | switch (enmCommand)
|
---|
1435 | {
|
---|
1436 | case kListNotSpecified:
|
---|
1437 | AssertFailed();
|
---|
1438 | return E_FAIL;
|
---|
1439 |
|
---|
1440 | case kListVMs:
|
---|
1441 | {
|
---|
1442 | /*
|
---|
1443 | * Get the list of all registered VMs
|
---|
1444 | */
|
---|
1445 | com::SafeIfaceArray<IMachine> machines;
|
---|
1446 | rc = pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
|
---|
1447 | if (SUCCEEDED(rc))
|
---|
1448 | {
|
---|
1449 | /*
|
---|
1450 | * Display it.
|
---|
1451 | */
|
---|
1452 | if (!fOptSorted)
|
---|
1453 | {
|
---|
1454 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
1455 | if (machines[i])
|
---|
1456 | rc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
1457 | }
|
---|
1458 | else
|
---|
1459 | {
|
---|
1460 | /*
|
---|
1461 | * Sort the list by name before displaying it.
|
---|
1462 | */
|
---|
1463 | std::vector<std::pair<com::Bstr, IMachine *> > sortedMachines;
|
---|
1464 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
1465 | {
|
---|
1466 | IMachine *pMachine = machines[i];
|
---|
1467 | if (pMachine) /* no idea why we need to do this... */
|
---|
1468 | {
|
---|
1469 | Bstr bstrName;
|
---|
1470 | pMachine->COMGETTER(Name)(bstrName.asOutParam());
|
---|
1471 | sortedMachines.push_back(std::pair<com::Bstr, IMachine *>(bstrName, pMachine));
|
---|
1472 | }
|
---|
1473 | }
|
---|
1474 |
|
---|
1475 | std::sort(sortedMachines.begin(), sortedMachines.end());
|
---|
1476 |
|
---|
1477 | for (size_t i = 0; i < sortedMachines.size(); ++i)
|
---|
1478 | rc = showVMInfo(pVirtualBox, sortedMachines[i].second, NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
1479 | }
|
---|
1480 | }
|
---|
1481 | break;
|
---|
1482 | }
|
---|
1483 |
|
---|
1484 | case kListRunningVMs:
|
---|
1485 | {
|
---|
1486 | /*
|
---|
1487 | * Get the list of all _running_ VMs
|
---|
1488 | */
|
---|
1489 | com::SafeIfaceArray<IMachine> machines;
|
---|
1490 | rc = pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
|
---|
1491 | com::SafeArray<MachineState_T> states;
|
---|
1492 | if (SUCCEEDED(rc))
|
---|
1493 | rc = pVirtualBox->GetMachineStates(ComSafeArrayAsInParam(machines), ComSafeArrayAsOutParam(states));
|
---|
1494 | if (SUCCEEDED(rc))
|
---|
1495 | {
|
---|
1496 | /*
|
---|
1497 | * Iterate through the collection
|
---|
1498 | */
|
---|
1499 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
1500 | {
|
---|
1501 | if (machines[i])
|
---|
1502 | {
|
---|
1503 | MachineState_T machineState = states[i];
|
---|
1504 | switch (machineState)
|
---|
1505 | {
|
---|
1506 | case MachineState_Running:
|
---|
1507 | case MachineState_Teleporting:
|
---|
1508 | case MachineState_LiveSnapshotting:
|
---|
1509 | case MachineState_Paused:
|
---|
1510 | case MachineState_TeleportingPausedVM:
|
---|
1511 | rc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
1512 | break;
|
---|
1513 | default: break; /* Shut up MSC */
|
---|
1514 | }
|
---|
1515 | }
|
---|
1516 | }
|
---|
1517 | }
|
---|
1518 | break;
|
---|
1519 | }
|
---|
1520 |
|
---|
1521 | case kListOsTypes:
|
---|
1522 | {
|
---|
1523 | com::SafeIfaceArray<IGuestOSType> coll;
|
---|
1524 | rc = pVirtualBox->COMGETTER(GuestOSTypes)(ComSafeArrayAsOutParam(coll));
|
---|
1525 | if (SUCCEEDED(rc))
|
---|
1526 | {
|
---|
1527 | /*
|
---|
1528 | * Iterate through the collection.
|
---|
1529 | */
|
---|
1530 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
1531 | {
|
---|
1532 | ComPtr<IGuestOSType> guestOS;
|
---|
1533 | guestOS = coll[i];
|
---|
1534 | Bstr guestId;
|
---|
1535 | guestOS->COMGETTER(Id)(guestId.asOutParam());
|
---|
1536 | RTPrintf("ID: %ls\n", guestId.raw());
|
---|
1537 | Bstr guestDescription;
|
---|
1538 | guestOS->COMGETTER(Description)(guestDescription.asOutParam());
|
---|
1539 | RTPrintf("Description: %ls\n", guestDescription.raw());
|
---|
1540 | Bstr familyId;
|
---|
1541 | guestOS->COMGETTER(FamilyId)(familyId.asOutParam());
|
---|
1542 | RTPrintf("Family ID: %ls\n", familyId.raw());
|
---|
1543 | Bstr familyDescription;
|
---|
1544 | guestOS->COMGETTER(FamilyDescription)(familyDescription.asOutParam());
|
---|
1545 | RTPrintf("Family Desc: %ls\n", familyDescription.raw());
|
---|
1546 | BOOL is64Bit;
|
---|
1547 | guestOS->COMGETTER(Is64Bit)(&is64Bit);
|
---|
1548 | RTPrintf("64 bit: %RTbool\n", is64Bit);
|
---|
1549 | RTPrintf("\n");
|
---|
1550 | }
|
---|
1551 | }
|
---|
1552 | break;
|
---|
1553 | }
|
---|
1554 |
|
---|
1555 | case kListHostDvds:
|
---|
1556 | {
|
---|
1557 | ComPtr<IHost> host;
|
---|
1558 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
1559 | com::SafeIfaceArray<IMedium> coll;
|
---|
1560 | CHECK_ERROR(host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
|
---|
1561 | if (SUCCEEDED(rc))
|
---|
1562 | {
|
---|
1563 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
1564 | {
|
---|
1565 | ComPtr<IMedium> dvdDrive = coll[i];
|
---|
1566 | Bstr uuid;
|
---|
1567 | dvdDrive->COMGETTER(Id)(uuid.asOutParam());
|
---|
1568 | RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
|
---|
1569 | Bstr location;
|
---|
1570 | dvdDrive->COMGETTER(Location)(location.asOutParam());
|
---|
1571 | RTPrintf("Name: %ls\n\n", location.raw());
|
---|
1572 | }
|
---|
1573 | }
|
---|
1574 | break;
|
---|
1575 | }
|
---|
1576 |
|
---|
1577 | case kListHostFloppies:
|
---|
1578 | {
|
---|
1579 | ComPtr<IHost> host;
|
---|
1580 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
1581 | com::SafeIfaceArray<IMedium> coll;
|
---|
1582 | CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(coll)));
|
---|
1583 | if (SUCCEEDED(rc))
|
---|
1584 | {
|
---|
1585 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
1586 | {
|
---|
1587 | ComPtr<IMedium> floppyDrive = coll[i];
|
---|
1588 | Bstr uuid;
|
---|
1589 | floppyDrive->COMGETTER(Id)(uuid.asOutParam());
|
---|
1590 | RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
|
---|
1591 | Bstr location;
|
---|
1592 | floppyDrive->COMGETTER(Location)(location.asOutParam());
|
---|
1593 | RTPrintf("Name: %ls\n\n", location.raw());
|
---|
1594 | }
|
---|
1595 | }
|
---|
1596 | break;
|
---|
1597 | }
|
---|
1598 |
|
---|
1599 | case kListInternalNetworks:
|
---|
1600 | rc = listInternalNetworks(pVirtualBox);
|
---|
1601 | break;
|
---|
1602 |
|
---|
1603 | case kListBridgedInterfaces:
|
---|
1604 | #if defined(VBOX_WITH_NETFLT)
|
---|
1605 | case kListHostOnlyInterfaces:
|
---|
1606 | #endif
|
---|
1607 | rc = listNetworkInterfaces(pVirtualBox, enmCommand == kListBridgedInterfaces);
|
---|
1608 | break;
|
---|
1609 |
|
---|
1610 | #if defined(VBOX_WITH_CLOUD_NET)
|
---|
1611 | case kListCloudNetworks:
|
---|
1612 | rc = listCloudNetworks(pVirtualBox);
|
---|
1613 | break;
|
---|
1614 | #endif
|
---|
1615 | case kListHostInfo:
|
---|
1616 | rc = listHostInfo(pVirtualBox);
|
---|
1617 | break;
|
---|
1618 |
|
---|
1619 | case kListHostCpuIDs:
|
---|
1620 | {
|
---|
1621 | ComPtr<IHost> Host;
|
---|
1622 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(Host.asOutParam()));
|
---|
1623 |
|
---|
1624 | RTPrintf("Host CPUIDs:\n\nLeaf no. EAX EBX ECX EDX\n");
|
---|
1625 | ULONG uCpuNo = 0; /* ASSUMES that CPU#0 is online. */
|
---|
1626 | static uint32_t const s_auCpuIdRanges[] =
|
---|
1627 | {
|
---|
1628 | UINT32_C(0x00000000), UINT32_C(0x0000007f),
|
---|
1629 | UINT32_C(0x80000000), UINT32_C(0x8000007f),
|
---|
1630 | UINT32_C(0xc0000000), UINT32_C(0xc000007f)
|
---|
1631 | };
|
---|
1632 | for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
|
---|
1633 | {
|
---|
1634 | ULONG uEAX, uEBX, uECX, uEDX, cLeafs;
|
---|
1635 | CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, s_auCpuIdRanges[i], 0, &cLeafs, &uEBX, &uECX, &uEDX));
|
---|
1636 | if (cLeafs < s_auCpuIdRanges[i] || cLeafs > s_auCpuIdRanges[i+1])
|
---|
1637 | continue;
|
---|
1638 | cLeafs++;
|
---|
1639 | for (ULONG iLeaf = s_auCpuIdRanges[i]; iLeaf <= cLeafs; iLeaf++)
|
---|
1640 | {
|
---|
1641 | CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, iLeaf, 0, &uEAX, &uEBX, &uECX, &uEDX));
|
---|
1642 | RTPrintf("%08x %08x %08x %08x %08x\n", iLeaf, uEAX, uEBX, uECX, uEDX);
|
---|
1643 | }
|
---|
1644 | }
|
---|
1645 | break;
|
---|
1646 | }
|
---|
1647 |
|
---|
1648 | case kListHddBackends:
|
---|
1649 | rc = listHddBackends(pVirtualBox);
|
---|
1650 | break;
|
---|
1651 |
|
---|
1652 | case kListHdds:
|
---|
1653 | {
|
---|
1654 | com::SafeIfaceArray<IMedium> hdds;
|
---|
1655 | CHECK_ERROR(pVirtualBox, COMGETTER(HardDisks)(ComSafeArrayAsOutParam(hdds)));
|
---|
1656 | rc = listMedia(pVirtualBox, hdds, "base", fOptLong);
|
---|
1657 | break;
|
---|
1658 | }
|
---|
1659 |
|
---|
1660 | case kListDvds:
|
---|
1661 | {
|
---|
1662 | com::SafeIfaceArray<IMedium> dvds;
|
---|
1663 | CHECK_ERROR(pVirtualBox, COMGETTER(DVDImages)(ComSafeArrayAsOutParam(dvds)));
|
---|
1664 | rc = listMedia(pVirtualBox, dvds, NULL, fOptLong);
|
---|
1665 | break;
|
---|
1666 | }
|
---|
1667 |
|
---|
1668 | case kListFloppies:
|
---|
1669 | {
|
---|
1670 | com::SafeIfaceArray<IMedium> floppies;
|
---|
1671 | CHECK_ERROR(pVirtualBox, COMGETTER(FloppyImages)(ComSafeArrayAsOutParam(floppies)));
|
---|
1672 | rc = listMedia(pVirtualBox, floppies, NULL, fOptLong);
|
---|
1673 | break;
|
---|
1674 | }
|
---|
1675 |
|
---|
1676 | case kListUsbHost:
|
---|
1677 | rc = listUsbHost(pVirtualBox);
|
---|
1678 | break;
|
---|
1679 |
|
---|
1680 | case kListUsbFilters:
|
---|
1681 | rc = listUsbFilters(pVirtualBox);
|
---|
1682 | break;
|
---|
1683 |
|
---|
1684 | case kListSystemProperties:
|
---|
1685 | rc = listSystemProperties(pVirtualBox);
|
---|
1686 | break;
|
---|
1687 |
|
---|
1688 | case kListDhcpServers:
|
---|
1689 | rc = listDhcpServers(pVirtualBox);
|
---|
1690 | break;
|
---|
1691 |
|
---|
1692 | case kListExtPacks:
|
---|
1693 | rc = listExtensionPacks(pVirtualBox);
|
---|
1694 | break;
|
---|
1695 |
|
---|
1696 | case kListGroups:
|
---|
1697 | rc = listGroups(pVirtualBox);
|
---|
1698 | break;
|
---|
1699 |
|
---|
1700 | case kListNatNetworks:
|
---|
1701 | {
|
---|
1702 | com::SafeIfaceArray<INATNetwork> nets;
|
---|
1703 | CHECK_ERROR(pVirtualBox, COMGETTER(NATNetworks)(ComSafeArrayAsOutParam(nets)));
|
---|
1704 | for (size_t i = 0; i < nets.size(); ++i)
|
---|
1705 | {
|
---|
1706 | ComPtr<INATNetwork> net = nets[i];
|
---|
1707 | Bstr netName;
|
---|
1708 | net->COMGETTER(NetworkName)(netName.asOutParam());
|
---|
1709 | RTPrintf("NetworkName: %ls\n", netName.raw());
|
---|
1710 | Bstr gateway;
|
---|
1711 | net->COMGETTER(Gateway)(gateway.asOutParam());
|
---|
1712 | RTPrintf("IP: %ls\n", gateway.raw());
|
---|
1713 | Bstr network;
|
---|
1714 | net->COMGETTER(Network)(network.asOutParam());
|
---|
1715 | RTPrintf("Network: %ls\n", network.raw());
|
---|
1716 | BOOL fEnabled;
|
---|
1717 | net->COMGETTER(IPv6Enabled)(&fEnabled);
|
---|
1718 | RTPrintf("IPv6 Enabled: %s\n", fEnabled ? "Yes" : "No");
|
---|
1719 | Bstr ipv6prefix;
|
---|
1720 | net->COMGETTER(IPv6Prefix)(ipv6prefix.asOutParam());
|
---|
1721 | RTPrintf("IPv6 Prefix: %ls\n", ipv6prefix.raw());
|
---|
1722 | net->COMGETTER(NeedDhcpServer)(&fEnabled);
|
---|
1723 | RTPrintf("DHCP Enabled: %s\n", fEnabled ? "Yes" : "No");
|
---|
1724 | net->COMGETTER(Enabled)(&fEnabled);
|
---|
1725 | RTPrintf("Enabled: %s\n", fEnabled ? "Yes" : "No");
|
---|
1726 |
|
---|
1727 | #define PRINT_STRING_ARRAY(title) \
|
---|
1728 | if (strs.size() > 0) \
|
---|
1729 | { \
|
---|
1730 | RTPrintf(title); \
|
---|
1731 | size_t j = 0; \
|
---|
1732 | for (;j < strs.size(); ++j) \
|
---|
1733 | RTPrintf(" %s\n", Utf8Str(strs[j]).c_str()); \
|
---|
1734 | }
|
---|
1735 |
|
---|
1736 | com::SafeArray<BSTR> strs;
|
---|
1737 |
|
---|
1738 | CHECK_ERROR(nets[i], COMGETTER(PortForwardRules4)(ComSafeArrayAsOutParam(strs)));
|
---|
1739 | PRINT_STRING_ARRAY("Port-forwarding (ipv4)\n");
|
---|
1740 | strs.setNull();
|
---|
1741 |
|
---|
1742 | CHECK_ERROR(nets[i], COMGETTER(PortForwardRules6)(ComSafeArrayAsOutParam(strs)));
|
---|
1743 | PRINT_STRING_ARRAY("Port-forwarding (ipv6)\n");
|
---|
1744 | strs.setNull();
|
---|
1745 |
|
---|
1746 | CHECK_ERROR(nets[i], COMGETTER(LocalMappings)(ComSafeArrayAsOutParam(strs)));
|
---|
1747 | PRINT_STRING_ARRAY("loopback mappings (ipv4)\n");
|
---|
1748 | strs.setNull();
|
---|
1749 |
|
---|
1750 | #undef PRINT_STRING_ARRAY
|
---|
1751 | RTPrintf("\n");
|
---|
1752 | }
|
---|
1753 | break;
|
---|
1754 | }
|
---|
1755 |
|
---|
1756 | case kListVideoInputDevices:
|
---|
1757 | rc = listVideoInputDevices(pVirtualBox);
|
---|
1758 | break;
|
---|
1759 |
|
---|
1760 | case kListScreenShotFormats:
|
---|
1761 | rc = listScreenShotFormats(pVirtualBox);
|
---|
1762 | break;
|
---|
1763 |
|
---|
1764 | case kListCloudProviders:
|
---|
1765 | rc = listCloudProviders(pVirtualBox);
|
---|
1766 | break;
|
---|
1767 |
|
---|
1768 | case kListCloudProfiles:
|
---|
1769 | rc = listCloudProfiles(pVirtualBox, fOptLong);
|
---|
1770 | break;
|
---|
1771 |
|
---|
1772 | case kListCPUProfiles:
|
---|
1773 | rc = listCPUProfiles(pVirtualBox, fOptLong, fOptSorted);
|
---|
1774 | break;
|
---|
1775 |
|
---|
1776 | /* No default here, want gcc warnings. */
|
---|
1777 |
|
---|
1778 | } /* end switch */
|
---|
1779 |
|
---|
1780 | return rc;
|
---|
1781 | }
|
---|
1782 |
|
---|
1783 | /**
|
---|
1784 | * Handles the 'list' command.
|
---|
1785 | *
|
---|
1786 | * @returns Appropriate exit code.
|
---|
1787 | * @param a Handler argument.
|
---|
1788 | */
|
---|
1789 | RTEXITCODE handleList(HandlerArg *a)
|
---|
1790 | {
|
---|
1791 | bool fOptLong = false;
|
---|
1792 | bool fOptMultiple = false;
|
---|
1793 | bool fOptSorted = false;
|
---|
1794 | enum ListType_T enmOptCommand = kListNotSpecified;
|
---|
1795 |
|
---|
1796 | static const RTGETOPTDEF s_aListOptions[] =
|
---|
1797 | {
|
---|
1798 | { "--long", 'l', RTGETOPT_REQ_NOTHING },
|
---|
1799 | { "--multiple", 'm', RTGETOPT_REQ_NOTHING }, /* not offical yet */
|
---|
1800 | { "--sorted", 's', RTGETOPT_REQ_NOTHING },
|
---|
1801 | { "vms", kListVMs, RTGETOPT_REQ_NOTHING },
|
---|
1802 | { "runningvms", kListRunningVMs, RTGETOPT_REQ_NOTHING },
|
---|
1803 | { "ostypes", kListOsTypes, RTGETOPT_REQ_NOTHING },
|
---|
1804 | { "hostdvds", kListHostDvds, RTGETOPT_REQ_NOTHING },
|
---|
1805 | { "hostfloppies", kListHostFloppies, RTGETOPT_REQ_NOTHING },
|
---|
1806 | { "intnets", kListInternalNetworks, RTGETOPT_REQ_NOTHING },
|
---|
1807 | { "hostifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING }, /* backward compatibility */
|
---|
1808 | { "bridgedifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING },
|
---|
1809 | #if defined(VBOX_WITH_NETFLT)
|
---|
1810 | { "hostonlyifs", kListHostOnlyInterfaces, RTGETOPT_REQ_NOTHING },
|
---|
1811 | #endif
|
---|
1812 | #if defined(VBOX_WITH_CLOUD_NET)
|
---|
1813 | { "cloudnets", kListCloudNetworks, RTGETOPT_REQ_NOTHING },
|
---|
1814 | #endif
|
---|
1815 | { "natnetworks", kListNatNetworks, RTGETOPT_REQ_NOTHING },
|
---|
1816 | { "natnets", kListNatNetworks, RTGETOPT_REQ_NOTHING },
|
---|
1817 | { "hostinfo", kListHostInfo, RTGETOPT_REQ_NOTHING },
|
---|
1818 | { "hostcpuids", kListHostCpuIDs, RTGETOPT_REQ_NOTHING },
|
---|
1819 | { "hddbackends", kListHddBackends, RTGETOPT_REQ_NOTHING },
|
---|
1820 | { "hdds", kListHdds, RTGETOPT_REQ_NOTHING },
|
---|
1821 | { "dvds", kListDvds, RTGETOPT_REQ_NOTHING },
|
---|
1822 | { "floppies", kListFloppies, RTGETOPT_REQ_NOTHING },
|
---|
1823 | { "usbhost", kListUsbHost, RTGETOPT_REQ_NOTHING },
|
---|
1824 | { "usbfilters", kListUsbFilters, RTGETOPT_REQ_NOTHING },
|
---|
1825 | { "systemproperties", kListSystemProperties, RTGETOPT_REQ_NOTHING },
|
---|
1826 | { "dhcpservers", kListDhcpServers, RTGETOPT_REQ_NOTHING },
|
---|
1827 | { "extpacks", kListExtPacks, RTGETOPT_REQ_NOTHING },
|
---|
1828 | { "groups", kListGroups, RTGETOPT_REQ_NOTHING },
|
---|
1829 | { "webcams", kListVideoInputDevices, RTGETOPT_REQ_NOTHING },
|
---|
1830 | { "screenshotformats", kListScreenShotFormats, RTGETOPT_REQ_NOTHING },
|
---|
1831 | { "cloudproviders", kListCloudProviders, RTGETOPT_REQ_NOTHING },
|
---|
1832 | { "cloudprofiles", kListCloudProfiles, RTGETOPT_REQ_NOTHING },
|
---|
1833 | { "cpu-profiles", kListCPUProfiles, RTGETOPT_REQ_NOTHING },
|
---|
1834 | };
|
---|
1835 |
|
---|
1836 | int ch;
|
---|
1837 | RTGETOPTUNION ValueUnion;
|
---|
1838 | RTGETOPTSTATE GetState;
|
---|
1839 | RTGetOptInit(&GetState, a->argc, a->argv, s_aListOptions, RT_ELEMENTS(s_aListOptions),
|
---|
1840 | 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
1841 | while ((ch = RTGetOpt(&GetState, &ValueUnion)))
|
---|
1842 | {
|
---|
1843 | switch (ch)
|
---|
1844 | {
|
---|
1845 | case 'l': /* --long */
|
---|
1846 | fOptLong = true;
|
---|
1847 | break;
|
---|
1848 |
|
---|
1849 | case 's':
|
---|
1850 | fOptSorted = true;
|
---|
1851 | break;
|
---|
1852 |
|
---|
1853 | case 'm':
|
---|
1854 | fOptMultiple = true;
|
---|
1855 | if (enmOptCommand == kListNotSpecified)
|
---|
1856 | break;
|
---|
1857 | ch = enmOptCommand;
|
---|
1858 | RT_FALL_THRU();
|
---|
1859 |
|
---|
1860 | case kListVMs:
|
---|
1861 | case kListRunningVMs:
|
---|
1862 | case kListOsTypes:
|
---|
1863 | case kListHostDvds:
|
---|
1864 | case kListHostFloppies:
|
---|
1865 | case kListInternalNetworks:
|
---|
1866 | case kListBridgedInterfaces:
|
---|
1867 | #if defined(VBOX_WITH_NETFLT)
|
---|
1868 | case kListHostOnlyInterfaces:
|
---|
1869 | #endif
|
---|
1870 | #if defined(VBOX_WITH_CLOUD_NET)
|
---|
1871 | case kListCloudNetworks:
|
---|
1872 | #endif
|
---|
1873 | case kListHostInfo:
|
---|
1874 | case kListHostCpuIDs:
|
---|
1875 | case kListHddBackends:
|
---|
1876 | case kListHdds:
|
---|
1877 | case kListDvds:
|
---|
1878 | case kListFloppies:
|
---|
1879 | case kListUsbHost:
|
---|
1880 | case kListUsbFilters:
|
---|
1881 | case kListSystemProperties:
|
---|
1882 | case kListDhcpServers:
|
---|
1883 | case kListExtPacks:
|
---|
1884 | case kListGroups:
|
---|
1885 | case kListNatNetworks:
|
---|
1886 | case kListVideoInputDevices:
|
---|
1887 | case kListScreenShotFormats:
|
---|
1888 | case kListCloudProviders:
|
---|
1889 | case kListCloudProfiles:
|
---|
1890 | case kListCPUProfiles:
|
---|
1891 | enmOptCommand = (enum ListType_T)ch;
|
---|
1892 | if (fOptMultiple)
|
---|
1893 | {
|
---|
1894 | HRESULT hrc = produceList(enmOptCommand, fOptLong, fOptSorted, a->virtualBox);
|
---|
1895 | if (FAILED(hrc))
|
---|
1896 | return RTEXITCODE_FAILURE;
|
---|
1897 | }
|
---|
1898 | break;
|
---|
1899 |
|
---|
1900 | case VINF_GETOPT_NOT_OPTION:
|
---|
1901 | return errorSyntax(USAGE_LIST, "Unknown subcommand \"%s\".", ValueUnion.psz);
|
---|
1902 |
|
---|
1903 | default:
|
---|
1904 | return errorGetOpt(USAGE_LIST, ch, &ValueUnion);
|
---|
1905 | }
|
---|
1906 | }
|
---|
1907 |
|
---|
1908 | /*
|
---|
1909 | * If not in multiple list mode, we have to produce the list now.
|
---|
1910 | */
|
---|
1911 | if (enmOptCommand == kListNotSpecified)
|
---|
1912 | return errorSyntax(USAGE_LIST, "Missing subcommand for \"list\" command.\n");
|
---|
1913 | if (!fOptMultiple)
|
---|
1914 | {
|
---|
1915 | HRESULT hrc = produceList(enmOptCommand, fOptLong, fOptSorted, a->virtualBox);
|
---|
1916 | if (FAILED(hrc))
|
---|
1917 | return RTEXITCODE_FAILURE;
|
---|
1918 | }
|
---|
1919 |
|
---|
1920 | return RTEXITCODE_SUCCESS;
|
---|
1921 | }
|
---|
1922 |
|
---|
1923 | #endif /* !VBOX_ONLY_DOCS */
|
---|
1924 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|