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