1 | /* $Id: VBoxManageList.cpp 28685 2010-04-24 15:03:33Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - The 'list' command.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef VBOX_ONLY_DOCS
|
---|
23 |
|
---|
24 | /*******************************************************************************
|
---|
25 | * Header Files *
|
---|
26 | *******************************************************************************/
|
---|
27 | #include <VBox/com/com.h>
|
---|
28 | #include <VBox/com/string.h>
|
---|
29 | #include <VBox/com/Guid.h>
|
---|
30 | #include <VBox/com/array.h>
|
---|
31 | #include <VBox/com/ErrorInfo.h>
|
---|
32 | #include <VBox/com/errorprint.h>
|
---|
33 |
|
---|
34 | #include <VBox/com/VirtualBox.h>
|
---|
35 |
|
---|
36 | #include <VBox/log.h>
|
---|
37 | #include <iprt/stream.h>
|
---|
38 | #include <iprt/string.h>
|
---|
39 | #include <iprt/time.h>
|
---|
40 | #include <iprt/getopt.h>
|
---|
41 | #include <iprt/ctype.h>
|
---|
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 | }
|
---|
55 | return "Unknown";
|
---|
56 | }
|
---|
57 |
|
---|
58 | static const char *getHostIfStatusText(HostNetworkInterfaceStatus_T enmStatus)
|
---|
59 | {
|
---|
60 | switch (enmStatus)
|
---|
61 | {
|
---|
62 | case HostNetworkInterfaceStatus_Up: return "Up";
|
---|
63 | case HostNetworkInterfaceStatus_Down: return "Down";
|
---|
64 | }
|
---|
65 | return "Unknown";
|
---|
66 | }
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | static void listHardDisks(const ComPtr<IVirtualBox> aVirtualBox,
|
---|
70 | const com::SafeIfaceArray<IMedium> &aMedia,
|
---|
71 | const char *pszParentUUIDStr)
|
---|
72 | {
|
---|
73 | HRESULT rc;
|
---|
74 | for (size_t i = 0; i < aMedia.size(); ++i)
|
---|
75 | {
|
---|
76 | ComPtr<IMedium> hdd = aMedia[i];
|
---|
77 | Bstr uuid;
|
---|
78 | hdd->COMGETTER(Id)(uuid.asOutParam());
|
---|
79 | RTPrintf("UUID: %s\n", Utf8Str(uuid).raw());
|
---|
80 | RTPrintf("Parent UUID: %s\n", pszParentUUIDStr);
|
---|
81 | Bstr format;
|
---|
82 | hdd->COMGETTER(Format)(format.asOutParam());
|
---|
83 | RTPrintf("Format: %lS\n", format.raw());
|
---|
84 | Bstr filepath;
|
---|
85 | hdd->COMGETTER(Location)(filepath.asOutParam());
|
---|
86 | RTPrintf("Location: %lS\n", filepath.raw());
|
---|
87 |
|
---|
88 | MediumState_T enmState;
|
---|
89 | hdd->RefreshState(&enmState);
|
---|
90 | const char *stateStr = "unknown";
|
---|
91 | switch (enmState)
|
---|
92 | {
|
---|
93 | case MediumState_NotCreated:
|
---|
94 | stateStr = "not created";
|
---|
95 | break;
|
---|
96 | case MediumState_Created:
|
---|
97 | stateStr = "created";
|
---|
98 | break;
|
---|
99 | case MediumState_LockedRead:
|
---|
100 | stateStr = "locked read";
|
---|
101 | break;
|
---|
102 | case MediumState_LockedWrite:
|
---|
103 | stateStr = "locked write";
|
---|
104 | break;
|
---|
105 | case MediumState_Inaccessible:
|
---|
106 | stateStr = "inaccessible";
|
---|
107 | break;
|
---|
108 | case MediumState_Creating:
|
---|
109 | stateStr = "creating";
|
---|
110 | break;
|
---|
111 | case MediumState_Deleting:
|
---|
112 | stateStr = "deleting";
|
---|
113 | break;
|
---|
114 | }
|
---|
115 | RTPrintf("State: %s\n", stateStr);
|
---|
116 |
|
---|
117 | MediumType_T type;
|
---|
118 | hdd->COMGETTER(Type)(&type);
|
---|
119 | const char *typeStr = "unknown";
|
---|
120 | switch (type)
|
---|
121 | {
|
---|
122 | case MediumType_Normal:
|
---|
123 | typeStr = "normal";
|
---|
124 | break;
|
---|
125 | case MediumType_Immutable:
|
---|
126 | typeStr = "immutable";
|
---|
127 | break;
|
---|
128 | case MediumType_Writethrough:
|
---|
129 | typeStr = "writethrough";
|
---|
130 | break;
|
---|
131 | }
|
---|
132 | RTPrintf("Type: %s\n", typeStr);
|
---|
133 |
|
---|
134 | com::SafeArray<BSTR> machineIds;
|
---|
135 | hdd->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds));
|
---|
136 | for (size_t j = 0; j < machineIds.size(); ++j)
|
---|
137 | {
|
---|
138 | ComPtr<IMachine> machine;
|
---|
139 | CHECK_ERROR(aVirtualBox, GetMachine(machineIds[j], machine.asOutParam()));
|
---|
140 | ASSERT(machine);
|
---|
141 | Bstr name;
|
---|
142 | machine->COMGETTER(Name)(name.asOutParam());
|
---|
143 | RTPrintf("%s%lS (UUID: %lS)",
|
---|
144 | j == 0 ? "Usage: " : " ",
|
---|
145 | name.raw(), machineIds[j]);
|
---|
146 | com::SafeArray<BSTR> snapshotIds;
|
---|
147 | hdd->GetSnapshotIds(machineIds[j],
|
---|
148 | ComSafeArrayAsOutParam(snapshotIds));
|
---|
149 | for (size_t k = 0; k < snapshotIds.size(); ++k)
|
---|
150 | {
|
---|
151 | ComPtr<ISnapshot> snapshot;
|
---|
152 | machine->GetSnapshot(snapshotIds[k], snapshot.asOutParam());
|
---|
153 | if (snapshot)
|
---|
154 | {
|
---|
155 | Bstr snapshotName;
|
---|
156 | snapshot->COMGETTER(Name)(snapshotName.asOutParam());
|
---|
157 | RTPrintf(" [%lS (UUID: %lS)]", snapshotName.raw(), snapshotIds[k]);
|
---|
158 | }
|
---|
159 | }
|
---|
160 | RTPrintf("\n");
|
---|
161 | }
|
---|
162 | RTPrintf("\n");
|
---|
163 |
|
---|
164 | com::SafeIfaceArray<IMedium> children;
|
---|
165 | CHECK_ERROR(hdd, COMGETTER(Children)(ComSafeArrayAsOutParam(children)));
|
---|
166 | if (children.size() > 0)
|
---|
167 | {
|
---|
168 | // depth first listing of child media
|
---|
169 | listHardDisks(aVirtualBox, children, Utf8Str(uuid).raw());
|
---|
170 | }
|
---|
171 | }
|
---|
172 | }
|
---|
173 |
|
---|
174 | enum enOptionCodes
|
---|
175 | {
|
---|
176 | LISTVMS = 1000,
|
---|
177 | LISTRUNNINGVMS,
|
---|
178 | LISTOSTYPES,
|
---|
179 | LISTHOSTDVDS,
|
---|
180 | LISTHOSTFLOPPIES,
|
---|
181 | LISTBRIDGEDIFS,
|
---|
182 | #if defined(VBOX_WITH_NETFLT)
|
---|
183 | LISTHOSTONLYIFS,
|
---|
184 | #endif
|
---|
185 | LISTHOSTCPUIDS,
|
---|
186 | LISTHOSTINFO,
|
---|
187 | LISTHDDBACKENDS,
|
---|
188 | LISTHDDS,
|
---|
189 | LISTDVDS,
|
---|
190 | LISTFLOPPIES,
|
---|
191 | LISTUSBHOST,
|
---|
192 | LISTUSBFILTERS,
|
---|
193 | LISTSYSTEMPROPERTIES,
|
---|
194 | LISTDHCPSERVERS
|
---|
195 | };
|
---|
196 |
|
---|
197 | static const RTGETOPTDEF g_aListOptions[]
|
---|
198 | = {
|
---|
199 | { "--long", 'l', RTGETOPT_REQ_NOTHING },
|
---|
200 | { "vms", LISTVMS, RTGETOPT_REQ_NOTHING },
|
---|
201 | { "runningvms", LISTRUNNINGVMS, RTGETOPT_REQ_NOTHING },
|
---|
202 | { "ostypes", LISTOSTYPES, RTGETOPT_REQ_NOTHING },
|
---|
203 | { "hostdvds", LISTHOSTDVDS, RTGETOPT_REQ_NOTHING },
|
---|
204 | { "hostfloppies", LISTHOSTFLOPPIES, RTGETOPT_REQ_NOTHING },
|
---|
205 | { "hostifs", LISTBRIDGEDIFS, RTGETOPT_REQ_NOTHING }, /* backward compatibility */
|
---|
206 | { "bridgedifs", LISTBRIDGEDIFS, RTGETOPT_REQ_NOTHING },
|
---|
207 | #if defined(VBOX_WITH_NETFLT)
|
---|
208 | { "hostonlyifs", LISTHOSTONLYIFS, RTGETOPT_REQ_NOTHING },
|
---|
209 | #endif
|
---|
210 | { "hostinfo", LISTHOSTINFO, RTGETOPT_REQ_NOTHING },
|
---|
211 | { "hostcpuids", LISTHOSTCPUIDS, RTGETOPT_REQ_NOTHING },
|
---|
212 | { "hddbackends", LISTHDDBACKENDS, RTGETOPT_REQ_NOTHING },
|
---|
213 | { "hdds", LISTHDDS, RTGETOPT_REQ_NOTHING },
|
---|
214 | { "dvds", LISTDVDS, RTGETOPT_REQ_NOTHING },
|
---|
215 | { "floppies", LISTFLOPPIES, RTGETOPT_REQ_NOTHING },
|
---|
216 | { "usbhost", LISTUSBHOST, RTGETOPT_REQ_NOTHING },
|
---|
217 | { "usbfilters", LISTUSBFILTERS, RTGETOPT_REQ_NOTHING },
|
---|
218 | { "systemproperties", LISTSYSTEMPROPERTIES, RTGETOPT_REQ_NOTHING },
|
---|
219 | { "dhcpservers", LISTDHCPSERVERS, RTGETOPT_REQ_NOTHING },
|
---|
220 | };
|
---|
221 |
|
---|
222 | int handleList(HandlerArg *a)
|
---|
223 | {
|
---|
224 | HRESULT rc = S_OK;
|
---|
225 |
|
---|
226 | bool fOptLong = false;
|
---|
227 |
|
---|
228 | int command = 0;
|
---|
229 | int c;
|
---|
230 |
|
---|
231 | RTGETOPTUNION ValueUnion;
|
---|
232 | RTGETOPTSTATE GetState;
|
---|
233 | RTGetOptInit(&GetState, a->argc, a->argv, g_aListOptions, RT_ELEMENTS(g_aListOptions),
|
---|
234 | 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
235 | while ((c = RTGetOpt(&GetState, &ValueUnion)))
|
---|
236 | {
|
---|
237 | switch (c)
|
---|
238 | {
|
---|
239 | case 'l': // --long
|
---|
240 | fOptLong = true;
|
---|
241 | break;
|
---|
242 |
|
---|
243 | case LISTVMS:
|
---|
244 | case LISTRUNNINGVMS:
|
---|
245 | case LISTOSTYPES:
|
---|
246 | case LISTHOSTDVDS:
|
---|
247 | case LISTHOSTFLOPPIES:
|
---|
248 | case LISTBRIDGEDIFS:
|
---|
249 | #if defined(VBOX_WITH_NETFLT)
|
---|
250 | case LISTHOSTONLYIFS:
|
---|
251 | #endif
|
---|
252 | case LISTHOSTINFO:
|
---|
253 | case LISTHOSTCPUIDS:
|
---|
254 | case LISTHDDBACKENDS:
|
---|
255 | case LISTHDDS:
|
---|
256 | case LISTDVDS:
|
---|
257 | case LISTFLOPPIES:
|
---|
258 | case LISTUSBHOST:
|
---|
259 | case LISTUSBFILTERS:
|
---|
260 | case LISTSYSTEMPROPERTIES:
|
---|
261 | case LISTDHCPSERVERS:
|
---|
262 | if (command)
|
---|
263 | return errorSyntax(USAGE_LIST, "Too many subcommands for \"list\" command.\n");
|
---|
264 |
|
---|
265 | command = c;
|
---|
266 | break;
|
---|
267 |
|
---|
268 | case VINF_GETOPT_NOT_OPTION:
|
---|
269 | return errorSyntax(USAGE_LIST, "Unknown subcommand \"%s\".", ValueUnion.psz);
|
---|
270 | break;
|
---|
271 |
|
---|
272 | default:
|
---|
273 | if (c > 0)
|
---|
274 | {
|
---|
275 | if (RT_C_IS_GRAPH(c))
|
---|
276 | return errorSyntax(USAGE_LIST, "unhandled option: -%c", c);
|
---|
277 | else
|
---|
278 | return errorSyntax(USAGE_LIST, "unhandled option: %i", c);
|
---|
279 | }
|
---|
280 | else if (c == VERR_GETOPT_UNKNOWN_OPTION)
|
---|
281 | return errorSyntax(USAGE_LIST, "unknown option: %s", ValueUnion.psz);
|
---|
282 | else if (ValueUnion.pDef)
|
---|
283 | return errorSyntax(USAGE_LIST, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
|
---|
284 | else
|
---|
285 | return errorSyntax(USAGE_LIST, "%Rrs", c);
|
---|
286 | }
|
---|
287 | }
|
---|
288 |
|
---|
289 | if (!command)
|
---|
290 | return errorSyntax(USAGE_LIST, "Missing subcommand for \"list\" command.\n");
|
---|
291 |
|
---|
292 | /* which object? */
|
---|
293 | switch (command)
|
---|
294 | {
|
---|
295 | case LISTVMS:
|
---|
296 | {
|
---|
297 | /*
|
---|
298 | * Get the list of all registered VMs
|
---|
299 | */
|
---|
300 | com::SafeIfaceArray <IMachine> machines;
|
---|
301 | rc = a->virtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
|
---|
302 | if (SUCCEEDED(rc))
|
---|
303 | {
|
---|
304 | /*
|
---|
305 | * Iterate through the collection
|
---|
306 | */
|
---|
307 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
308 | {
|
---|
309 | if (machines[i])
|
---|
310 | rc = showVMInfo(a->virtualBox,
|
---|
311 | machines[i],
|
---|
312 | (fOptLong) ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
313 | }
|
---|
314 | }
|
---|
315 | }
|
---|
316 | break;
|
---|
317 |
|
---|
318 | case LISTRUNNINGVMS:
|
---|
319 | {
|
---|
320 | /*
|
---|
321 | * Get the list of all _running_ VMs
|
---|
322 | */
|
---|
323 | com::SafeIfaceArray <IMachine> machines;
|
---|
324 | rc = a->virtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
|
---|
325 | if (SUCCEEDED(rc))
|
---|
326 | {
|
---|
327 | /*
|
---|
328 | * Iterate through the collection
|
---|
329 | */
|
---|
330 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
331 | {
|
---|
332 | if (machines[i])
|
---|
333 | {
|
---|
334 | MachineState_T machineState;
|
---|
335 | rc = machines[i]->COMGETTER(State)(&machineState);
|
---|
336 | if (SUCCEEDED(rc))
|
---|
337 | {
|
---|
338 | switch (machineState)
|
---|
339 | {
|
---|
340 | case MachineState_Running:
|
---|
341 | case MachineState_Teleporting:
|
---|
342 | case MachineState_LiveSnapshotting:
|
---|
343 | case MachineState_Paused:
|
---|
344 | case MachineState_TeleportingPausedVM:
|
---|
345 | rc = showVMInfo(a->virtualBox,
|
---|
346 | machines[i],
|
---|
347 | (fOptLong) ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
348 | }
|
---|
349 | }
|
---|
350 | }
|
---|
351 | }
|
---|
352 | }
|
---|
353 | }
|
---|
354 | break;
|
---|
355 |
|
---|
356 | case LISTOSTYPES:
|
---|
357 | {
|
---|
358 | com::SafeIfaceArray <IGuestOSType> coll;
|
---|
359 | rc = a->virtualBox->COMGETTER(GuestOSTypes)(ComSafeArrayAsOutParam(coll));
|
---|
360 | if (SUCCEEDED(rc))
|
---|
361 | {
|
---|
362 | /*
|
---|
363 | * Iterate through the collection.
|
---|
364 | */
|
---|
365 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
366 | {
|
---|
367 | ComPtr<IGuestOSType> guestOS;
|
---|
368 | guestOS = coll[i];
|
---|
369 | Bstr guestId;
|
---|
370 | guestOS->COMGETTER(Id)(guestId.asOutParam());
|
---|
371 | RTPrintf("ID: %lS\n", guestId.raw());
|
---|
372 | Bstr guestDescription;
|
---|
373 | guestOS->COMGETTER(Description)(guestDescription.asOutParam());
|
---|
374 | RTPrintf("Description: %lS\n\n", guestDescription.raw());
|
---|
375 | }
|
---|
376 | }
|
---|
377 | }
|
---|
378 | break;
|
---|
379 |
|
---|
380 | case LISTHOSTDVDS:
|
---|
381 | {
|
---|
382 | ComPtr<IHost> host;
|
---|
383 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
384 | com::SafeIfaceArray <IMedium> coll;
|
---|
385 | CHECK_ERROR(host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
|
---|
386 | if (SUCCEEDED(rc))
|
---|
387 | {
|
---|
388 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
389 | {
|
---|
390 | ComPtr<IMedium> dvdDrive = coll[i];
|
---|
391 | Bstr uuid;
|
---|
392 | dvdDrive->COMGETTER(Id)(uuid.asOutParam());
|
---|
393 | RTPrintf("UUID: %s\n", Utf8Str(uuid).raw());
|
---|
394 | Bstr name;
|
---|
395 | dvdDrive->COMGETTER(Name)(name.asOutParam());
|
---|
396 | RTPrintf("Name: %lS\n\n", name.raw());
|
---|
397 | }
|
---|
398 | }
|
---|
399 | }
|
---|
400 | break;
|
---|
401 |
|
---|
402 | case LISTHOSTFLOPPIES:
|
---|
403 | {
|
---|
404 | ComPtr<IHost> host;
|
---|
405 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
406 | com::SafeIfaceArray <IMedium> coll;
|
---|
407 | CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(coll)));
|
---|
408 | if (SUCCEEDED(rc))
|
---|
409 | {
|
---|
410 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
411 | {
|
---|
412 | ComPtr<IMedium> floppyDrive = coll[i];
|
---|
413 | Bstr uuid;
|
---|
414 | floppyDrive->COMGETTER(Id)(uuid.asOutParam());
|
---|
415 | RTPrintf("UUID: %s\n", Utf8Str(uuid).raw());
|
---|
416 | Bstr name;
|
---|
417 | floppyDrive->COMGETTER(Name)(name.asOutParam());
|
---|
418 | RTPrintf("Name: %lS\n\n", name.raw());
|
---|
419 | }
|
---|
420 | }
|
---|
421 | }
|
---|
422 | break;
|
---|
423 |
|
---|
424 | case LISTBRIDGEDIFS:
|
---|
425 | #if defined(VBOX_WITH_NETFLT)
|
---|
426 | case LISTHOSTONLYIFS:
|
---|
427 | #endif
|
---|
428 | {
|
---|
429 | ComPtr<IHost> host;
|
---|
430 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
431 | com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces;
|
---|
432 | #if defined(VBOX_WITH_NETFLT)
|
---|
433 | if (command == LISTBRIDGEDIFS)
|
---|
434 | CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_Bridged,
|
---|
435 | ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
436 | else
|
---|
437 | CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_HostOnly,
|
---|
438 | ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
439 | #else
|
---|
440 | CHECK_ERROR(host, COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
441 | #endif
|
---|
442 | for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i)
|
---|
443 | {
|
---|
444 | ComPtr<IHostNetworkInterface> networkInterface = hostNetworkInterfaces[i];
|
---|
445 | #ifndef VBOX_WITH_HOSTNETIF_API
|
---|
446 | Bstr interfaceName;
|
---|
447 | networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
|
---|
448 | RTPrintf("Name: %lS\n", interfaceName.raw());
|
---|
449 | Guid interfaceGuid;
|
---|
450 | networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
451 | RTPrintf("GUID: %lS\n\n", Bstr(interfaceGuid.toString()).raw());
|
---|
452 | #else /* VBOX_WITH_HOSTNETIF_API */
|
---|
453 | Bstr interfaceName;
|
---|
454 | networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
|
---|
455 | RTPrintf("Name: %lS\n", interfaceName.raw());
|
---|
456 | Bstr interfaceGuid;
|
---|
457 | networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
458 | RTPrintf("GUID: %lS\n", interfaceGuid.raw());
|
---|
459 | BOOL bDhcpEnabled;
|
---|
460 | networkInterface->COMGETTER(DhcpEnabled)(&bDhcpEnabled);
|
---|
461 | RTPrintf("Dhcp: %s\n", bDhcpEnabled ? "Enabled" : "Disabled");
|
---|
462 |
|
---|
463 | Bstr IPAddress;
|
---|
464 | networkInterface->COMGETTER(IPAddress)(IPAddress.asOutParam());
|
---|
465 | RTPrintf("IPAddress: %lS\n", IPAddress.raw());
|
---|
466 | Bstr NetworkMask;
|
---|
467 | networkInterface->COMGETTER(NetworkMask)(NetworkMask.asOutParam());
|
---|
468 | RTPrintf("NetworkMask: %lS\n", NetworkMask.raw());
|
---|
469 | Bstr IPV6Address;
|
---|
470 | networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam());
|
---|
471 | RTPrintf("IPV6Address: %lS\n", IPV6Address.raw());
|
---|
472 | ULONG IPV6NetworkMaskPrefixLength;
|
---|
473 | networkInterface->COMGETTER(IPV6NetworkMaskPrefixLength)(&IPV6NetworkMaskPrefixLength);
|
---|
474 | RTPrintf("IPV6NetworkMaskPrefixLength: %d\n", IPV6NetworkMaskPrefixLength);
|
---|
475 | Bstr HardwareAddress;
|
---|
476 | networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam());
|
---|
477 | RTPrintf("HardwareAddress: %lS\n", HardwareAddress.raw());
|
---|
478 | HostNetworkInterfaceMediumType_T Type;
|
---|
479 | networkInterface->COMGETTER(MediumType)(&Type);
|
---|
480 | RTPrintf("MediumType: %s\n", getHostIfMediumTypeText(Type));
|
---|
481 | HostNetworkInterfaceStatus_T Status;
|
---|
482 | networkInterface->COMGETTER(Status)(&Status);
|
---|
483 | RTPrintf("Status: %s\n", getHostIfStatusText(Status));
|
---|
484 | Bstr netName;
|
---|
485 | networkInterface->COMGETTER(NetworkName)(netName.asOutParam());
|
---|
486 | RTPrintf("VBoxNetworkName: %lS\n\n", netName.raw());
|
---|
487 |
|
---|
488 | #endif
|
---|
489 | }
|
---|
490 | }
|
---|
491 | break;
|
---|
492 |
|
---|
493 | case LISTHOSTINFO:
|
---|
494 | {
|
---|
495 | ComPtr<IHost> Host;
|
---|
496 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(Host.asOutParam()));
|
---|
497 |
|
---|
498 | RTPrintf("Host Information:\n\n");
|
---|
499 |
|
---|
500 | LONG64 uTCTime = 0;
|
---|
501 | CHECK_ERROR(Host, COMGETTER(UTCTime)(&uTCTime));
|
---|
502 | RTTIMESPEC timeSpec;
|
---|
503 | RTTimeSpecSetMilli(&timeSpec, uTCTime);
|
---|
504 | char szTime[32] = {0};
|
---|
505 | RTTimeSpecToString(&timeSpec, szTime, sizeof(szTime));
|
---|
506 | RTPrintf("Host time: %s\n", szTime);
|
---|
507 |
|
---|
508 | ULONG processorOnlineCount = 0;
|
---|
509 | CHECK_ERROR(Host, COMGETTER(ProcessorOnlineCount)(&processorOnlineCount));
|
---|
510 | RTPrintf("Processor online count: %lu\n", processorOnlineCount);
|
---|
511 | ULONG processorCount = 0;
|
---|
512 | CHECK_ERROR(Host, COMGETTER(ProcessorCount)(&processorCount));
|
---|
513 | RTPrintf("Processor count: %lu\n", processorCount);
|
---|
514 | ULONG processorSpeed = 0;
|
---|
515 | Bstr processorDescription;
|
---|
516 | for (ULONG i = 0; i < processorCount; i++)
|
---|
517 | {
|
---|
518 | CHECK_ERROR(Host, GetProcessorSpeed(i, &processorSpeed));
|
---|
519 | if (processorSpeed)
|
---|
520 | RTPrintf("Processor#%u speed: %lu MHz\n", i, processorSpeed);
|
---|
521 | else
|
---|
522 | RTPrintf("Processor#%u speed: unknown\n", i, processorSpeed);
|
---|
523 | CHECK_ERROR(Host, GetProcessorDescription(i, processorDescription.asOutParam()));
|
---|
524 | RTPrintf("Processor#%u description: %lS\n", i, processorDescription.raw());
|
---|
525 | }
|
---|
526 |
|
---|
527 | ULONG memorySize = 0;
|
---|
528 | CHECK_ERROR(Host, COMGETTER(MemorySize)(&memorySize));
|
---|
529 | RTPrintf("Memory size: %lu MByte\n", memorySize);
|
---|
530 |
|
---|
531 | ULONG memoryAvailable = 0;
|
---|
532 | CHECK_ERROR(Host, COMGETTER(MemoryAvailable)(&memoryAvailable));
|
---|
533 | RTPrintf("Memory available: %lu MByte\n", memoryAvailable);
|
---|
534 |
|
---|
535 | Bstr operatingSystem;
|
---|
536 | CHECK_ERROR(Host, COMGETTER(OperatingSystem)(operatingSystem.asOutParam()));
|
---|
537 | RTPrintf("Operating system: %lS\n", operatingSystem.raw());
|
---|
538 |
|
---|
539 | Bstr oSVersion;
|
---|
540 | CHECK_ERROR(Host, COMGETTER(OSVersion)(oSVersion.asOutParam()));
|
---|
541 | RTPrintf("Operating system version: %lS\n", oSVersion.raw());
|
---|
542 | }
|
---|
543 | break;
|
---|
544 |
|
---|
545 | case LISTHOSTCPUIDS:
|
---|
546 | {
|
---|
547 | ComPtr<IHost> Host;
|
---|
548 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(Host.asOutParam()));
|
---|
549 |
|
---|
550 | RTPrintf("Host CPUIDs:\n\nLeaf no. EAX EBX ECX EDX\n");
|
---|
551 | ULONG uCpuNo = 0; /* ASSUMES that CPU#0 is online. */
|
---|
552 | static uint32_t const s_auCpuIdRanges[] =
|
---|
553 | {
|
---|
554 | UINT32_C(0x00000000), UINT32_C(0x0000007f),
|
---|
555 | UINT32_C(0x80000000), UINT32_C(0x8000007f),
|
---|
556 | UINT32_C(0xc0000000), UINT32_C(0xc000007f)
|
---|
557 | };
|
---|
558 | for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
|
---|
559 | {
|
---|
560 | ULONG uEAX, uEBX, uECX, uEDX, cLeafs;
|
---|
561 | CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, s_auCpuIdRanges[i], 0, &cLeafs, &uEBX, &uECX, &uEDX));
|
---|
562 | if (cLeafs < s_auCpuIdRanges[i] || cLeafs > s_auCpuIdRanges[i+1])
|
---|
563 | continue;
|
---|
564 | cLeafs++;
|
---|
565 | for (ULONG iLeaf = s_auCpuIdRanges[i]; iLeaf <= cLeafs; iLeaf++)
|
---|
566 | {
|
---|
567 | CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, iLeaf, 0, &uEAX, &uEBX, &uECX, &uEDX));
|
---|
568 | RTPrintf("%08x %08x %08x %08x %08x\n", iLeaf, uEAX, uEBX, uECX, uEDX);
|
---|
569 | }
|
---|
570 | }
|
---|
571 | }
|
---|
572 | break;
|
---|
573 |
|
---|
574 | case LISTHDDBACKENDS:
|
---|
575 | {
|
---|
576 | ComPtr<ISystemProperties> systemProperties;
|
---|
577 | CHECK_ERROR(a->virtualBox,
|
---|
578 | COMGETTER(SystemProperties)(systemProperties.asOutParam()));
|
---|
579 | com::SafeIfaceArray <IMediumFormat> mediumFormats;
|
---|
580 | CHECK_ERROR(systemProperties,
|
---|
581 | COMGETTER(MediumFormats)(ComSafeArrayAsOutParam(mediumFormats)));
|
---|
582 |
|
---|
583 | RTPrintf("Supported hard disk backends:\n\n");
|
---|
584 | for (size_t i = 0; i < mediumFormats.size(); ++i)
|
---|
585 | {
|
---|
586 | /* General information */
|
---|
587 | Bstr id;
|
---|
588 | CHECK_ERROR(mediumFormats[i], COMGETTER(Id)(id.asOutParam()));
|
---|
589 |
|
---|
590 | Bstr description;
|
---|
591 | CHECK_ERROR(mediumFormats[i],
|
---|
592 | COMGETTER(Id)(description.asOutParam()));
|
---|
593 |
|
---|
594 | ULONG caps;
|
---|
595 | CHECK_ERROR(mediumFormats[i],
|
---|
596 | COMGETTER(Capabilities)(&caps));
|
---|
597 |
|
---|
598 | RTPrintf("Backend %u: id='%ls' description='%ls' capabilities=%#06x extensions='",
|
---|
599 | i, id.raw(), description.raw(), caps);
|
---|
600 |
|
---|
601 | /* File extensions */
|
---|
602 | com::SafeArray <BSTR> fileExtensions;
|
---|
603 | CHECK_ERROR(mediumFormats[i],
|
---|
604 | COMGETTER(FileExtensions)(ComSafeArrayAsOutParam(fileExtensions)));
|
---|
605 | for (size_t j = 0; j < fileExtensions.size(); ++j)
|
---|
606 | {
|
---|
607 | RTPrintf("%ls", Bstr(fileExtensions[j]).raw());
|
---|
608 | if (j != fileExtensions.size()-1)
|
---|
609 | RTPrintf(",");
|
---|
610 | }
|
---|
611 | RTPrintf("'");
|
---|
612 |
|
---|
613 | /* Configuration keys */
|
---|
614 | com::SafeArray <BSTR> propertyNames;
|
---|
615 | com::SafeArray <BSTR> propertyDescriptions;
|
---|
616 | com::SafeArray <DataType_T> propertyTypes;
|
---|
617 | com::SafeArray <ULONG> propertyFlags;
|
---|
618 | com::SafeArray <BSTR> propertyDefaults;
|
---|
619 | CHECK_ERROR(mediumFormats[i],
|
---|
620 | DescribeProperties(ComSafeArrayAsOutParam(propertyNames),
|
---|
621 | ComSafeArrayAsOutParam(propertyDescriptions),
|
---|
622 | ComSafeArrayAsOutParam(propertyTypes),
|
---|
623 | ComSafeArrayAsOutParam(propertyFlags),
|
---|
624 | ComSafeArrayAsOutParam(propertyDefaults)));
|
---|
625 |
|
---|
626 | RTPrintf(" properties=(");
|
---|
627 | if (propertyNames.size() > 0)
|
---|
628 | {
|
---|
629 | for (size_t j = 0; j < propertyNames.size(); ++j)
|
---|
630 | {
|
---|
631 | RTPrintf("\n name='%ls' desc='%ls' type=",
|
---|
632 | Bstr(propertyNames[j]).raw(), Bstr(propertyDescriptions[j]).raw());
|
---|
633 | switch (propertyTypes[j])
|
---|
634 | {
|
---|
635 | case DataType_Int32: RTPrintf("int"); break;
|
---|
636 | case DataType_Int8: RTPrintf("byte"); break;
|
---|
637 | case DataType_String: RTPrintf("string"); break;
|
---|
638 | }
|
---|
639 | RTPrintf(" flags=%#04x", propertyFlags[j]);
|
---|
640 | RTPrintf(" default='%ls'", Bstr(propertyDefaults[j]).raw());
|
---|
641 | if (j != propertyNames.size()-1)
|
---|
642 | RTPrintf(", ");
|
---|
643 | }
|
---|
644 | }
|
---|
645 | RTPrintf(")\n");
|
---|
646 | }
|
---|
647 | }
|
---|
648 | break;
|
---|
649 |
|
---|
650 | case LISTHDDS:
|
---|
651 | {
|
---|
652 | com::SafeIfaceArray<IMedium> hdds;
|
---|
653 | CHECK_ERROR(a->virtualBox, COMGETTER(HardDisks)(ComSafeArrayAsOutParam(hdds)));
|
---|
654 | listHardDisks(a->virtualBox, hdds, "base");
|
---|
655 | }
|
---|
656 | break;
|
---|
657 |
|
---|
658 | case LISTDVDS:
|
---|
659 | {
|
---|
660 | com::SafeIfaceArray<IMedium> dvds;
|
---|
661 | CHECK_ERROR(a->virtualBox, COMGETTER(DVDImages)(ComSafeArrayAsOutParam(dvds)));
|
---|
662 | for (size_t i = 0; i < dvds.size(); ++i)
|
---|
663 | {
|
---|
664 | ComPtr<IMedium> dvdImage = dvds[i];
|
---|
665 | Bstr uuid;
|
---|
666 | dvdImage->COMGETTER(Id)(uuid.asOutParam());
|
---|
667 | RTPrintf("UUID: %s\n", Utf8Str(uuid).raw());
|
---|
668 | Bstr filePath;
|
---|
669 | dvdImage->COMGETTER(Location)(filePath.asOutParam());
|
---|
670 | RTPrintf("Path: %lS\n", filePath.raw());
|
---|
671 | MediumState_T enmState;
|
---|
672 | dvdImage->RefreshState(&enmState);
|
---|
673 | RTPrintf("Accessible: %s\n", enmState != MediumState_Inaccessible ? "yes" : "no");
|
---|
674 |
|
---|
675 | com::SafeArray<BSTR> machineIds;
|
---|
676 | dvdImage->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds));
|
---|
677 | for (size_t j = 0; j < machineIds.size(); ++j)
|
---|
678 | {
|
---|
679 | ComPtr<IMachine> machine;
|
---|
680 | CHECK_ERROR(a->virtualBox, GetMachine(machineIds[j], machine.asOutParam()));
|
---|
681 | ASSERT(machine);
|
---|
682 | Bstr name;
|
---|
683 | machine->COMGETTER(Name)(name.asOutParam());
|
---|
684 | machine->COMGETTER(Id)(uuid.asOutParam());
|
---|
685 | RTPrintf("%s%lS (UUID: %lS)\n",
|
---|
686 | j == 0 ? "Usage: " : " ",
|
---|
687 | name.raw(), machineIds[j]);
|
---|
688 | }
|
---|
689 | RTPrintf("\n");
|
---|
690 | }
|
---|
691 | }
|
---|
692 | break;
|
---|
693 |
|
---|
694 | case LISTFLOPPIES:
|
---|
695 | {
|
---|
696 | com::SafeIfaceArray<IMedium> floppies;
|
---|
697 | CHECK_ERROR(a->virtualBox, COMGETTER(FloppyImages)(ComSafeArrayAsOutParam(floppies)));
|
---|
698 | for (size_t i = 0; i < floppies.size(); ++i)
|
---|
699 | {
|
---|
700 | ComPtr<IMedium> floppyImage = floppies[i];
|
---|
701 | Bstr uuid;
|
---|
702 | floppyImage->COMGETTER(Id)(uuid.asOutParam());
|
---|
703 | RTPrintf("UUID: %s\n", Utf8Str(uuid).raw());
|
---|
704 | Bstr filePath;
|
---|
705 | floppyImage->COMGETTER(Location)(filePath.asOutParam());
|
---|
706 | RTPrintf("Path: %lS\n", filePath.raw());
|
---|
707 | MediumState_T enmState;
|
---|
708 | floppyImage->RefreshState(&enmState);
|
---|
709 | RTPrintf("Accessible: %s\n", enmState != MediumState_Inaccessible ? "yes" : "no");
|
---|
710 |
|
---|
711 | com::SafeArray<BSTR> machineIds;
|
---|
712 | floppyImage->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds));
|
---|
713 | for (size_t j = 0; j < machineIds.size(); ++j)
|
---|
714 | {
|
---|
715 | ComPtr<IMachine> machine;
|
---|
716 | CHECK_ERROR(a->virtualBox, GetMachine(machineIds[j], machine.asOutParam()));
|
---|
717 | ASSERT(machine);
|
---|
718 | Bstr name;
|
---|
719 | machine->COMGETTER(Name)(name.asOutParam());
|
---|
720 | machine->COMGETTER(Id)(uuid.asOutParam());
|
---|
721 | RTPrintf("%s%lS (UUID: %lS)\n",
|
---|
722 | j == 0 ? "Usage: " : " ",
|
---|
723 | name.raw(), machineIds[j]);
|
---|
724 | }
|
---|
725 | RTPrintf("\n");
|
---|
726 | }
|
---|
727 | }
|
---|
728 | break;
|
---|
729 |
|
---|
730 | case LISTUSBHOST:
|
---|
731 | {
|
---|
732 | ComPtr<IHost> Host;
|
---|
733 | CHECK_ERROR_RET(a->virtualBox, COMGETTER(Host)(Host.asOutParam()), 1);
|
---|
734 |
|
---|
735 | SafeIfaceArray <IHostUSBDevice> CollPtr;
|
---|
736 | CHECK_ERROR_RET(Host, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(CollPtr)), 1);
|
---|
737 |
|
---|
738 | RTPrintf("Host USB Devices:\n\n");
|
---|
739 |
|
---|
740 | if (CollPtr.size() == 0)
|
---|
741 | {
|
---|
742 | RTPrintf("<none>\n\n");
|
---|
743 | }
|
---|
744 | else
|
---|
745 | {
|
---|
746 | for (size_t i = 0; i < CollPtr.size(); ++i)
|
---|
747 | {
|
---|
748 | ComPtr <IHostUSBDevice> dev = CollPtr[i];
|
---|
749 |
|
---|
750 | /* Query info. */
|
---|
751 | Bstr id;
|
---|
752 | CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), 1);
|
---|
753 | USHORT usVendorId;
|
---|
754 | CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), 1);
|
---|
755 | USHORT usProductId;
|
---|
756 | CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), 1);
|
---|
757 | USHORT bcdRevision;
|
---|
758 | CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), 1);
|
---|
759 |
|
---|
760 | RTPrintf("UUID: %S\n"
|
---|
761 | "VendorId: 0x%04x (%04X)\n"
|
---|
762 | "ProductId: 0x%04x (%04X)\n"
|
---|
763 | "Revision: %u.%u (%02u%02u)\n",
|
---|
764 | Utf8Str(id).raw(),
|
---|
765 | usVendorId, usVendorId, usProductId, usProductId,
|
---|
766 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
767 | bcdRevision >> 8, bcdRevision & 0xff);
|
---|
768 |
|
---|
769 | /* optional stuff. */
|
---|
770 | Bstr bstr;
|
---|
771 | CHECK_ERROR_RET(dev, COMGETTER(Manufacturer)(bstr.asOutParam()), 1);
|
---|
772 | if (!bstr.isEmpty())
|
---|
773 | RTPrintf("Manufacturer: %lS\n", bstr.raw());
|
---|
774 | CHECK_ERROR_RET(dev, COMGETTER(Product)(bstr.asOutParam()), 1);
|
---|
775 | if (!bstr.isEmpty())
|
---|
776 | RTPrintf("Product: %lS\n", bstr.raw());
|
---|
777 | CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
|
---|
778 | if (!bstr.isEmpty())
|
---|
779 | RTPrintf("SerialNumber: %lS\n", bstr.raw());
|
---|
780 | CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), 1);
|
---|
781 | if (!bstr.isEmpty())
|
---|
782 | RTPrintf("Address: %lS\n", bstr.raw());
|
---|
783 |
|
---|
784 | /* current state */
|
---|
785 | USBDeviceState_T state;
|
---|
786 | CHECK_ERROR_RET(dev, COMGETTER(State)(&state), 1);
|
---|
787 | const char *pszState = "?";
|
---|
788 | switch (state)
|
---|
789 | {
|
---|
790 | case USBDeviceState_NotSupported:
|
---|
791 | pszState = "Not supported"; break;
|
---|
792 | case USBDeviceState_Unavailable:
|
---|
793 | pszState = "Unavailable"; break;
|
---|
794 | case USBDeviceState_Busy:
|
---|
795 | pszState = "Busy"; break;
|
---|
796 | case USBDeviceState_Available:
|
---|
797 | pszState = "Available"; break;
|
---|
798 | case USBDeviceState_Held:
|
---|
799 | pszState = "Held"; break;
|
---|
800 | case USBDeviceState_Captured:
|
---|
801 | pszState = "Captured"; break;
|
---|
802 | default:
|
---|
803 | ASSERT(false);
|
---|
804 | break;
|
---|
805 | }
|
---|
806 | RTPrintf("Current State: %s\n\n", pszState);
|
---|
807 | }
|
---|
808 | }
|
---|
809 | }
|
---|
810 | break;
|
---|
811 |
|
---|
812 | case LISTUSBFILTERS:
|
---|
813 | {
|
---|
814 | RTPrintf("Global USB Device Filters:\n\n");
|
---|
815 |
|
---|
816 | ComPtr <IHost> host;
|
---|
817 | CHECK_ERROR_RET(a->virtualBox, COMGETTER(Host)(host.asOutParam()), 1);
|
---|
818 |
|
---|
819 | SafeIfaceArray <IHostUSBDeviceFilter> coll;
|
---|
820 | CHECK_ERROR_RET(host, COMGETTER(USBDeviceFilters)(ComSafeArrayAsOutParam(coll)), 1);
|
---|
821 |
|
---|
822 | if (coll.size() == 0)
|
---|
823 | {
|
---|
824 | RTPrintf("<none>\n\n");
|
---|
825 | }
|
---|
826 | else
|
---|
827 | {
|
---|
828 | for (size_t index = 0; index < coll.size(); ++index)
|
---|
829 | {
|
---|
830 | ComPtr<IHostUSBDeviceFilter> flt = coll[index];
|
---|
831 |
|
---|
832 | /* Query info. */
|
---|
833 |
|
---|
834 | RTPrintf("Index: %zu\n", index);
|
---|
835 |
|
---|
836 | BOOL active = FALSE;
|
---|
837 | CHECK_ERROR_RET(flt, COMGETTER(Active)(&active), 1);
|
---|
838 | RTPrintf("Active: %s\n", active ? "yes" : "no");
|
---|
839 |
|
---|
840 | USBDeviceFilterAction_T action;
|
---|
841 | CHECK_ERROR_RET(flt, COMGETTER(Action)(&action), 1);
|
---|
842 | const char *pszAction = "<invalid>";
|
---|
843 | switch (action)
|
---|
844 | {
|
---|
845 | case USBDeviceFilterAction_Ignore:
|
---|
846 | pszAction = "Ignore";
|
---|
847 | break;
|
---|
848 | case USBDeviceFilterAction_Hold:
|
---|
849 | pszAction = "Hold";
|
---|
850 | break;
|
---|
851 | default:
|
---|
852 | break;
|
---|
853 | }
|
---|
854 | RTPrintf("Action: %s\n", pszAction);
|
---|
855 |
|
---|
856 | Bstr bstr;
|
---|
857 | CHECK_ERROR_RET(flt, COMGETTER(Name)(bstr.asOutParam()), 1);
|
---|
858 | RTPrintf("Name: %lS\n", bstr.raw());
|
---|
859 | CHECK_ERROR_RET(flt, COMGETTER(VendorId)(bstr.asOutParam()), 1);
|
---|
860 | RTPrintf("VendorId: %lS\n", bstr.raw());
|
---|
861 | CHECK_ERROR_RET(flt, COMGETTER(ProductId)(bstr.asOutParam()), 1);
|
---|
862 | RTPrintf("ProductId: %lS\n", bstr.raw());
|
---|
863 | CHECK_ERROR_RET(flt, COMGETTER(Revision)(bstr.asOutParam()), 1);
|
---|
864 | RTPrintf("Revision: %lS\n", bstr.raw());
|
---|
865 | CHECK_ERROR_RET(flt, COMGETTER(Manufacturer)(bstr.asOutParam()), 1);
|
---|
866 | RTPrintf("Manufacturer: %lS\n", bstr.raw());
|
---|
867 | CHECK_ERROR_RET(flt, COMGETTER(Product)(bstr.asOutParam()), 1);
|
---|
868 | RTPrintf("Product: %lS\n", bstr.raw());
|
---|
869 | CHECK_ERROR_RET(flt, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
|
---|
870 | RTPrintf("Serial Number: %lS\n\n", bstr.raw());
|
---|
871 | }
|
---|
872 | }
|
---|
873 | }
|
---|
874 | break;
|
---|
875 |
|
---|
876 | case LISTSYSTEMPROPERTIES:
|
---|
877 | {
|
---|
878 | ComPtr<ISystemProperties> systemProperties;
|
---|
879 | a->virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam());
|
---|
880 |
|
---|
881 | Bstr str;
|
---|
882 | ULONG ulValue;
|
---|
883 | ULONG64 ul64Value;
|
---|
884 |
|
---|
885 | systemProperties->COMGETTER(MinGuestRAM)(&ulValue);
|
---|
886 | RTPrintf("Minimum guest RAM size: %u Megabytes\n", ulValue);
|
---|
887 | systemProperties->COMGETTER(MaxGuestRAM)(&ulValue);
|
---|
888 | RTPrintf("Maximum guest RAM size: %u Megabytes\n", ulValue);
|
---|
889 | systemProperties->COMGETTER(MinGuestVRAM)(&ulValue);
|
---|
890 | RTPrintf("Minimum video RAM size: %u Megabytes\n", ulValue);
|
---|
891 | systemProperties->COMGETTER(MaxGuestVRAM)(&ulValue);
|
---|
892 | RTPrintf("Maximum video RAM size: %u Megabytes\n", ulValue);
|
---|
893 | systemProperties->COMGETTER(MinGuestCPUCount)(&ulValue);
|
---|
894 | RTPrintf("Minimum guest CPU count: %u\n", ulValue);
|
---|
895 | systemProperties->COMGETTER(MaxGuestCPUCount)(&ulValue);
|
---|
896 | RTPrintf("Maximum guest CPU count: %u\n", ulValue);
|
---|
897 | systemProperties->COMGETTER(MaxVDISize)(&ul64Value);
|
---|
898 | RTPrintf("Maximum VDI size: %lu Megabytes\n", ul64Value);
|
---|
899 | systemProperties->COMGETTER(NetworkAdapterCount)(&ulValue);
|
---|
900 | RTPrintf("Maximum Network Adapter count: %u\n", ulValue);
|
---|
901 | systemProperties->COMGETTER(SerialPortCount)(&ulValue);
|
---|
902 | RTPrintf("Maximum Serial Port count: %u\n", ulValue);
|
---|
903 | systemProperties->COMGETTER(ParallelPortCount)(&ulValue);
|
---|
904 | RTPrintf("Maximum Parallel Port count: %u\n", ulValue);
|
---|
905 | systemProperties->COMGETTER(MaxBootPosition)(&ulValue);
|
---|
906 | RTPrintf("Maximum Boot Position: %u\n", ulValue);
|
---|
907 | systemProperties->GetMaxInstancesOfStorageBus(StorageBus_IDE, &ulValue);
|
---|
908 | RTPrintf("Maximum IDE Controllers: %u\n", ulValue);
|
---|
909 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_IDE, &ulValue);
|
---|
910 | RTPrintf("Maximum IDE Port count: %u\n", ulValue);
|
---|
911 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_IDE, &ulValue);
|
---|
912 | RTPrintf("Maximum Devices per IDE Port: %u\n", ulValue);
|
---|
913 | systemProperties->GetMaxInstancesOfStorageBus(StorageBus_SATA, &ulValue);
|
---|
914 | RTPrintf("Maximum SATA Controllers: %u\n", ulValue);
|
---|
915 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SATA, &ulValue);
|
---|
916 | RTPrintf("Maximum SATA Port count: %u\n", ulValue);
|
---|
917 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SATA, &ulValue);
|
---|
918 | RTPrintf("Maximum Devices per SATA Port: %u\n", ulValue);
|
---|
919 | systemProperties->GetMaxInstancesOfStorageBus(StorageBus_SCSI, &ulValue);
|
---|
920 | RTPrintf("Maximum SCSI Controllers: %u\n", ulValue);
|
---|
921 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SCSI, &ulValue);
|
---|
922 | RTPrintf("Maximum SCSI Port count: %u\n", ulValue);
|
---|
923 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SCSI, &ulValue);
|
---|
924 | RTPrintf("Maximum Devices per SCSI Port: %u\n", ulValue);
|
---|
925 | systemProperties->GetMaxInstancesOfStorageBus(StorageBus_SAS, &ulValue);
|
---|
926 | RTPrintf("Maximum SAS Controllers: %u\n", ulValue);
|
---|
927 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_SAS, &ulValue);
|
---|
928 | RTPrintf("Maximum SAS Port count: %u\n", ulValue);
|
---|
929 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SAS, &ulValue);
|
---|
930 | RTPrintf("Maximum Devices per SAS Port: %u\n", ulValue);
|
---|
931 | systemProperties->GetMaxInstancesOfStorageBus(StorageBus_Floppy, &ulValue);
|
---|
932 | RTPrintf("Maximum Floppy Controllers: %u\n", ulValue);
|
---|
933 | systemProperties->GetMaxPortCountForStorageBus(StorageBus_Floppy, &ulValue);
|
---|
934 | RTPrintf("Maximum Floppy Port count: %u\n", ulValue);
|
---|
935 | systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_Floppy, &ulValue);
|
---|
936 | RTPrintf("Maximum Devices per Floppy Port: %u\n", ulValue);
|
---|
937 | systemProperties->COMGETTER(DefaultMachineFolder)(str.asOutParam());
|
---|
938 | RTPrintf("Default machine folder: %lS\n", str.raw());
|
---|
939 | systemProperties->COMGETTER(DefaultHardDiskFolder)(str.asOutParam());
|
---|
940 | RTPrintf("Default hard disk folder: %lS\n", str.raw());
|
---|
941 | systemProperties->COMGETTER(RemoteDisplayAuthLibrary)(str.asOutParam());
|
---|
942 | RTPrintf("VRDP authentication library: %lS\n", str.raw());
|
---|
943 | systemProperties->COMGETTER(WebServiceAuthLibrary)(str.asOutParam());
|
---|
944 | RTPrintf("Webservice auth. library: %lS\n", str.raw());
|
---|
945 | systemProperties->COMGETTER(LogHistoryCount)(&ulValue);
|
---|
946 | RTPrintf("Log history count: %u\n", ulValue);
|
---|
947 |
|
---|
948 | }
|
---|
949 | break;
|
---|
950 | case LISTDHCPSERVERS:
|
---|
951 | {
|
---|
952 | com::SafeIfaceArray<IDHCPServer> svrs;
|
---|
953 | CHECK_ERROR(a->virtualBox, COMGETTER(DHCPServers)(ComSafeArrayAsOutParam(svrs)));
|
---|
954 | for (size_t i = 0; i < svrs.size(); ++i)
|
---|
955 | {
|
---|
956 | ComPtr<IDHCPServer> svr = svrs[i];
|
---|
957 | Bstr netName;
|
---|
958 | svr->COMGETTER(NetworkName)(netName.asOutParam());
|
---|
959 | RTPrintf("NetworkName: %lS\n", netName.raw());
|
---|
960 | Bstr ip;
|
---|
961 | svr->COMGETTER(IPAddress)(ip.asOutParam());
|
---|
962 | RTPrintf("IP: %lS\n", ip.raw());
|
---|
963 | Bstr netmask;
|
---|
964 | svr->COMGETTER(NetworkMask)(netmask.asOutParam());
|
---|
965 | RTPrintf("NetworkMask: %lS\n", netmask.raw());
|
---|
966 | Bstr lowerIp;
|
---|
967 | svr->COMGETTER(LowerIP)(lowerIp.asOutParam());
|
---|
968 | RTPrintf("lowerIPAddress: %lS\n", lowerIp.raw());
|
---|
969 | Bstr upperIp;
|
---|
970 | svr->COMGETTER(UpperIP)(upperIp.asOutParam());
|
---|
971 | RTPrintf("upperIPAddress: %lS\n", upperIp.raw());
|
---|
972 | BOOL bEnabled;
|
---|
973 | svr->COMGETTER(Enabled)(&bEnabled);
|
---|
974 | RTPrintf("Enabled: %s\n", bEnabled ? "Yes" : "No");
|
---|
975 | RTPrintf("\n");
|
---|
976 | }
|
---|
977 | }
|
---|
978 | break;
|
---|
979 | } // end switch
|
---|
980 |
|
---|
981 | return SUCCEEDED(rc) ? 0 : 1;
|
---|
982 | }
|
---|
983 |
|
---|
984 | #endif /* !VBOX_ONLY_DOCS */
|
---|
985 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|