1 | /* $Id: VBoxManageInfo.cpp 17843 2009-03-13 15:51:55Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - The 'showvminfo' command and helper routines.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2009 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/errorprint2.h>
|
---|
33 |
|
---|
34 | #include <VBox/com/VirtualBox.h>
|
---|
35 |
|
---|
36 | #include <VBox/log.h>
|
---|
37 | #include <iprt/stream.h>
|
---|
38 | #include <iprt/time.h>
|
---|
39 | #include <iprt/string.h>
|
---|
40 |
|
---|
41 | #include "VBoxManage.h"
|
---|
42 | using namespace com;
|
---|
43 |
|
---|
44 |
|
---|
45 | // funcs
|
---|
46 | ///////////////////////////////////////////////////////////////////////////////
|
---|
47 |
|
---|
48 | void showSnapshots(ComPtr<ISnapshot> rootSnapshot, VMINFO_DETAILS details, const Bstr &prefix /* = ""*/, int level /*= 0*/)
|
---|
49 | {
|
---|
50 | /* start with the root */
|
---|
51 | Bstr name;
|
---|
52 | Guid uuid;
|
---|
53 | rootSnapshot->COMGETTER(Name)(name.asOutParam());
|
---|
54 | rootSnapshot->COMGETTER(Id)(uuid.asOutParam());
|
---|
55 | if (details == VMINFO_MACHINEREADABLE)
|
---|
56 | {
|
---|
57 | /* print with hierarchical numbering */
|
---|
58 | RTPrintf("SnapshotName%lS=\"%lS\"\n", prefix.raw(), name.raw());
|
---|
59 | RTPrintf("SnapshotUUID%lS=\"%s\"\n", prefix.raw(), uuid.toString().raw());
|
---|
60 | }
|
---|
61 | else
|
---|
62 | {
|
---|
63 | /* print with indentation */
|
---|
64 | RTPrintf(" %lSName: %lS (UUID: %s)\n", prefix.raw(), name.raw(), uuid.toString().raw());
|
---|
65 | }
|
---|
66 |
|
---|
67 | /* get the children */
|
---|
68 | SafeIfaceArray <ISnapshot> coll;
|
---|
69 | rootSnapshot->COMGETTER(Children)(ComSafeArrayAsOutParam(coll));
|
---|
70 | if (!coll.isNull())
|
---|
71 | {
|
---|
72 | for (size_t index = 0; index < coll.size(); ++index)
|
---|
73 | {
|
---|
74 | ComPtr<ISnapshot> snapshot = coll[index];
|
---|
75 | if (snapshot)
|
---|
76 | {
|
---|
77 | Bstr newPrefix;
|
---|
78 | if (details == VMINFO_MACHINEREADABLE)
|
---|
79 | newPrefix = Utf8StrFmt("%lS-%d", prefix.raw(), index + 1);
|
---|
80 | else
|
---|
81 | newPrefix = Utf8StrFmt("%lS ", prefix.raw());
|
---|
82 | /* recursive call */
|
---|
83 | showSnapshots(snapshot, details, newPrefix, level + 1);
|
---|
84 | }
|
---|
85 | }
|
---|
86 | }
|
---|
87 | }
|
---|
88 |
|
---|
89 | static void makeTimeStr (char *s, int cb, int64_t millies)
|
---|
90 | {
|
---|
91 | RTTIME t;
|
---|
92 | RTTIMESPEC ts;
|
---|
93 |
|
---|
94 | RTTimeSpecSetMilli(&ts, millies);
|
---|
95 |
|
---|
96 | RTTimeExplode (&t, &ts);
|
---|
97 |
|
---|
98 | RTStrPrintf(s, cb, "%04d/%02d/%02d %02d:%02d:%02d UTC",
|
---|
99 | t.i32Year, t.u8Month, t.u8MonthDay,
|
---|
100 | t.u8Hour, t.u8Minute, t.u8Second);
|
---|
101 | }
|
---|
102 |
|
---|
103 | /* Disable global optimizations for MSC 8.0/64 to make it compile in reasonable
|
---|
104 | time. MSC 7.1/32 doesn't have quite as much trouble with it, but still
|
---|
105 | sufficient to qualify for this hack as well since this code isn't performance
|
---|
106 | critical and probably won't gain much from the extra optimizing in real life. */
|
---|
107 | #if defined(_MSC_VER)
|
---|
108 | # pragma optimize("g", off)
|
---|
109 | #endif
|
---|
110 |
|
---|
111 | HRESULT showVMInfo (ComPtr<IVirtualBox> virtualBox,
|
---|
112 | ComPtr<IMachine> machine,
|
---|
113 | VMINFO_DETAILS details /*= VMINFO_NONE*/,
|
---|
114 | ComPtr<IConsole> console /*= ComPtr <IConsole> ()*/)
|
---|
115 | {
|
---|
116 | HRESULT rc;
|
---|
117 |
|
---|
118 | /*
|
---|
119 | * The rules for output in -argdump format:
|
---|
120 | * 1) the key part (the [0-9a-zA-Z_]+ string before the '=' delimiter)
|
---|
121 | * is all lowercase for "VBoxManage modifyvm" parameters. Any
|
---|
122 | * other values printed are in CamelCase.
|
---|
123 | * 2) strings (anything non-decimal) are printed surrounded by
|
---|
124 | * double quotes '"'. If the strings themselves contain double
|
---|
125 | * quotes, these characters are escaped by '\'. Any '\' character
|
---|
126 | * in the original string is also escaped by '\'.
|
---|
127 | * 3) numbers (containing just [0-9\-]) are written out unchanged.
|
---|
128 | */
|
---|
129 |
|
---|
130 | /** @todo the quoting is not yet implemented! */
|
---|
131 |
|
---|
132 | BOOL accessible = FALSE;
|
---|
133 | CHECK_ERROR (machine, COMGETTER(Accessible) (&accessible));
|
---|
134 | CheckComRCReturnRC (rc);
|
---|
135 |
|
---|
136 | Guid uuid;
|
---|
137 | rc = machine->COMGETTER(Id) (uuid.asOutParam());
|
---|
138 |
|
---|
139 | if (!accessible)
|
---|
140 | {
|
---|
141 | if (details == VMINFO_COMPACT)
|
---|
142 | RTPrintf("\"<inaccessible>\" {%s}\n", uuid.toString().raw());
|
---|
143 | else
|
---|
144 | {
|
---|
145 | if (details == VMINFO_MACHINEREADABLE)
|
---|
146 | RTPrintf("name=\"<inaccessible>\"\n");
|
---|
147 | else
|
---|
148 | RTPrintf ("Name: <inaccessible!>\n");
|
---|
149 | if (details == VMINFO_MACHINEREADABLE)
|
---|
150 | RTPrintf ("UUID=\"%s\"\n", uuid.toString().raw());
|
---|
151 | else
|
---|
152 | RTPrintf ("UUID: %s\n", uuid.toString().raw());
|
---|
153 | if (details != VMINFO_MACHINEREADABLE)
|
---|
154 | {
|
---|
155 | Bstr settingsFilePath;
|
---|
156 | rc = machine->COMGETTER(SettingsFilePath) (settingsFilePath.asOutParam());
|
---|
157 | RTPrintf ("Config file: %lS\n", settingsFilePath.raw());
|
---|
158 | ComPtr<IVirtualBoxErrorInfo> accessError;
|
---|
159 | rc = machine->COMGETTER(AccessError) (accessError.asOutParam());
|
---|
160 | RTPrintf ("Access error details:\n");
|
---|
161 | ErrorInfo ei (accessError);
|
---|
162 | GluePrintErrorInfo(ei);
|
---|
163 | RTPrintf ("\n");
|
---|
164 | }
|
---|
165 | }
|
---|
166 | return S_OK;
|
---|
167 | }
|
---|
168 |
|
---|
169 | Bstr machineName;
|
---|
170 | rc = machine->COMGETTER(Name)(machineName.asOutParam());
|
---|
171 |
|
---|
172 | if (details == VMINFO_COMPACT)
|
---|
173 | {
|
---|
174 | RTPrintf("\"%lS\" {%s}\n", machineName.raw(), uuid.toString().raw());
|
---|
175 | return S_OK;
|
---|
176 | }
|
---|
177 |
|
---|
178 | if (details == VMINFO_MACHINEREADABLE)
|
---|
179 | RTPrintf("name=\"%lS\"\n", machineName.raw());
|
---|
180 | else
|
---|
181 | RTPrintf("Name: %lS\n", machineName.raw());
|
---|
182 |
|
---|
183 | Bstr osTypeId;
|
---|
184 | rc = machine->COMGETTER(OSTypeId)(osTypeId.asOutParam());
|
---|
185 | ComPtr<IGuestOSType> osType;
|
---|
186 | rc = virtualBox->GetGuestOSType (osTypeId, osType.asOutParam());
|
---|
187 | Bstr osName;
|
---|
188 | rc = osType->COMGETTER(Description)(osName.asOutParam());
|
---|
189 | if (details == VMINFO_MACHINEREADABLE)
|
---|
190 | RTPrintf("ostype=\"%lS\"\n", osTypeId.raw());
|
---|
191 | else
|
---|
192 | RTPrintf("Guest OS: %lS\n", osName.raw());
|
---|
193 |
|
---|
194 | if (details == VMINFO_MACHINEREADABLE)
|
---|
195 | RTPrintf("UUID=\"%s\"\n", uuid.toString().raw());
|
---|
196 | else
|
---|
197 | RTPrintf("UUID: %s\n", uuid.toString().raw());
|
---|
198 |
|
---|
199 | Bstr settingsFilePath;
|
---|
200 | rc = machine->COMGETTER(SettingsFilePath)(settingsFilePath.asOutParam());
|
---|
201 | if (details == VMINFO_MACHINEREADABLE)
|
---|
202 | RTPrintf("CfgFile=\"%lS\"\n", settingsFilePath.raw());
|
---|
203 | else
|
---|
204 | RTPrintf("Config file: %lS\n", settingsFilePath.raw());
|
---|
205 |
|
---|
206 | ULONG memorySize;
|
---|
207 | rc = machine->COMGETTER(MemorySize)(&memorySize);
|
---|
208 | if (details == VMINFO_MACHINEREADABLE)
|
---|
209 | RTPrintf("memory=%u\n", memorySize);
|
---|
210 | else
|
---|
211 | RTPrintf("Memory size: %uMB\n", memorySize);
|
---|
212 |
|
---|
213 | ULONG vramSize;
|
---|
214 | rc = machine->COMGETTER(VRAMSize)(&vramSize);
|
---|
215 | if (details == VMINFO_MACHINEREADABLE)
|
---|
216 | RTPrintf("vram=%u\n", vramSize);
|
---|
217 | else
|
---|
218 | RTPrintf("VRAM size: %uMB\n", vramSize);
|
---|
219 |
|
---|
220 | ComPtr <IBIOSSettings> biosSettings;
|
---|
221 | machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
|
---|
222 |
|
---|
223 | BIOSBootMenuMode_T bootMenuMode;
|
---|
224 | biosSettings->COMGETTER(BootMenuMode)(&bootMenuMode);
|
---|
225 | const char *pszBootMenu = NULL;
|
---|
226 | switch (bootMenuMode)
|
---|
227 | {
|
---|
228 | case BIOSBootMenuMode_Disabled:
|
---|
229 | pszBootMenu = "disabled";
|
---|
230 | break;
|
---|
231 | case BIOSBootMenuMode_MenuOnly:
|
---|
232 | if (details == VMINFO_MACHINEREADABLE)
|
---|
233 | pszBootMenu = "menuonly";
|
---|
234 | else
|
---|
235 | pszBootMenu = "menu only";
|
---|
236 | break;
|
---|
237 | default:
|
---|
238 | if (details == VMINFO_MACHINEREADABLE)
|
---|
239 | pszBootMenu = "messageandmenu";
|
---|
240 | else
|
---|
241 | pszBootMenu = "message and menu";
|
---|
242 | }
|
---|
243 | if (details == VMINFO_MACHINEREADABLE)
|
---|
244 | RTPrintf("bootmenu=\"%s\"\n", pszBootMenu);
|
---|
245 | else
|
---|
246 | RTPrintf("Boot menu mode: %s\n", pszBootMenu);
|
---|
247 |
|
---|
248 | BOOL acpiEnabled;
|
---|
249 | biosSettings->COMGETTER(ACPIEnabled)(&acpiEnabled);
|
---|
250 | if (details == VMINFO_MACHINEREADABLE)
|
---|
251 | RTPrintf("acpi=\"%s\"\n", acpiEnabled ? "on" : "off");
|
---|
252 | else
|
---|
253 | RTPrintf("ACPI: %s\n", acpiEnabled ? "on" : "off");
|
---|
254 |
|
---|
255 | BOOL ioapicEnabled;
|
---|
256 | biosSettings->COMGETTER(IOAPICEnabled)(&ioapicEnabled);
|
---|
257 | if (details == VMINFO_MACHINEREADABLE)
|
---|
258 | RTPrintf("ioapic=\"%s\"\n", ioapicEnabled ? "on" : "off");
|
---|
259 | else
|
---|
260 | RTPrintf("IOAPIC: %s\n", ioapicEnabled ? "on" : "off");
|
---|
261 |
|
---|
262 | BOOL PAEEnabled;
|
---|
263 | machine->COMGETTER(PAEEnabled)(&PAEEnabled);
|
---|
264 | if (details == VMINFO_MACHINEREADABLE)
|
---|
265 | RTPrintf("pae=\"%s\"\n", PAEEnabled ? "on" : "off");
|
---|
266 | else
|
---|
267 | RTPrintf("PAE: %s\n", PAEEnabled ? "on" : "off");
|
---|
268 |
|
---|
269 | LONG64 timeOffset;
|
---|
270 | biosSettings->COMGETTER(TimeOffset)(&timeOffset);
|
---|
271 | if (details == VMINFO_MACHINEREADABLE)
|
---|
272 | RTPrintf("biossystemtimeoffset=%lld\n", timeOffset);
|
---|
273 | else
|
---|
274 | RTPrintf("Time offset: %lld ms\n", timeOffset);
|
---|
275 |
|
---|
276 | TSBool_T hwVirtExEnabled;
|
---|
277 | machine->COMGETTER(HWVirtExEnabled)(&hwVirtExEnabled);
|
---|
278 | if (hwVirtExEnabled == TSBool_Default)
|
---|
279 | {
|
---|
280 | BOOL fHWVirtExEnabled;
|
---|
281 | ComPtr<ISystemProperties> systemProperties;
|
---|
282 | virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam());
|
---|
283 | systemProperties->COMGETTER(HWVirtExEnabled)(&fHWVirtExEnabled);
|
---|
284 | if (details == VMINFO_MACHINEREADABLE)
|
---|
285 | RTPrintf("hwvirtex=\"default\"\n");
|
---|
286 | else
|
---|
287 | RTPrintf("Hardw. virt.ext: Default (%s)\n", fHWVirtExEnabled ? "on" : "off");
|
---|
288 | }
|
---|
289 | else
|
---|
290 | {
|
---|
291 | if (details == VMINFO_MACHINEREADABLE)
|
---|
292 | RTPrintf("hwvirtex=\"%s\"\n", hwVirtExEnabled == TSBool_True ? "on" : "off");
|
---|
293 | else
|
---|
294 | RTPrintf("Hardw. virt.ext: %s\n", hwVirtExEnabled == TSBool_True ? "on" : "off");
|
---|
295 | }
|
---|
296 | BOOL HWVirtExNestedPagingEnabled;
|
---|
297 | machine->COMGETTER(HWVirtExNestedPagingEnabled)(&HWVirtExNestedPagingEnabled);
|
---|
298 | if (details == VMINFO_MACHINEREADABLE)
|
---|
299 | RTPrintf("nestedpaging=\"%s\"\n", HWVirtExNestedPagingEnabled ? "on" : "off");
|
---|
300 | else
|
---|
301 | RTPrintf("Nested Paging: %s\n", HWVirtExNestedPagingEnabled ? "on" : "off");
|
---|
302 |
|
---|
303 | BOOL HWVirtExVPIDEnabled;
|
---|
304 | machine->COMGETTER(HWVirtExVPIDEnabled)(&HWVirtExVPIDEnabled);
|
---|
305 | if (details == VMINFO_MACHINEREADABLE)
|
---|
306 | RTPrintf("vtxvpid=\"%s\"\n", HWVirtExVPIDEnabled ? "on" : "off");
|
---|
307 | else
|
---|
308 | RTPrintf("VT-x VPID: %s\n", HWVirtExVPIDEnabled ? "on" : "off");
|
---|
309 |
|
---|
310 | MachineState_T machineState;
|
---|
311 | const char *pszState = NULL;
|
---|
312 | rc = machine->COMGETTER(State)(&machineState);
|
---|
313 | switch (machineState)
|
---|
314 | {
|
---|
315 | case MachineState_PoweredOff:
|
---|
316 | if (details == VMINFO_MACHINEREADABLE)
|
---|
317 | pszState = "poweroff";
|
---|
318 | else
|
---|
319 | pszState = "powered off";
|
---|
320 | break;
|
---|
321 | case MachineState_Saved:
|
---|
322 | pszState = "saved";
|
---|
323 | break;
|
---|
324 | case MachineState_Aborted:
|
---|
325 | pszState = "aborted";
|
---|
326 | break;
|
---|
327 | case MachineState_Running:
|
---|
328 | pszState = "running";
|
---|
329 | break;
|
---|
330 | case MachineState_Paused:
|
---|
331 | pszState = "paused";
|
---|
332 | break;
|
---|
333 | case MachineState_Starting:
|
---|
334 | pszState = "starting";
|
---|
335 | break;
|
---|
336 | case MachineState_Stopping:
|
---|
337 | pszState = "stopping";
|
---|
338 | break;
|
---|
339 | case MachineState_Saving:
|
---|
340 | pszState = "saving";
|
---|
341 | break;
|
---|
342 | case MachineState_Restoring:
|
---|
343 | pszState = "restoring";
|
---|
344 | break;
|
---|
345 | default:
|
---|
346 | pszState = "unknown";
|
---|
347 | break;
|
---|
348 | }
|
---|
349 | LONG64 stateSince;
|
---|
350 | machine->COMGETTER(LastStateChange)(&stateSince);
|
---|
351 | RTTIMESPEC timeSpec;
|
---|
352 | RTTimeSpecSetMilli(&timeSpec, stateSince);
|
---|
353 | char pszTime[30] = {0};
|
---|
354 | RTTimeSpecToString(&timeSpec, pszTime, sizeof(pszTime));
|
---|
355 | if (details == VMINFO_MACHINEREADABLE)
|
---|
356 | {
|
---|
357 | RTPrintf("VMState=\"%s\"\n", pszState);
|
---|
358 | RTPrintf("VMStateChangeTime=\"%s\"\n", pszTime);
|
---|
359 | }
|
---|
360 | else
|
---|
361 | RTPrintf("State: %s (since %s)\n", pszState, pszTime);
|
---|
362 |
|
---|
363 | ULONG numMonitors;
|
---|
364 | machine->COMGETTER(MonitorCount)(&numMonitors);
|
---|
365 | if (details == VMINFO_MACHINEREADABLE)
|
---|
366 | RTPrintf("monitorcount=%d\n", numMonitors);
|
---|
367 | else
|
---|
368 | RTPrintf("Monitor count: %d\n", numMonitors);
|
---|
369 |
|
---|
370 | BOOL accelerate3d;
|
---|
371 | machine->COMGETTER(Accelerate3DEnabled)(&accelerate3d);
|
---|
372 | if (details == VMINFO_MACHINEREADABLE)
|
---|
373 | RTPrintf("accelerate3d=\"%s\"\n", accelerate3d ? "on" : "off");
|
---|
374 | else
|
---|
375 | RTPrintf("3D Acceleration: %s\n", accelerate3d ? "on" : "off");
|
---|
376 |
|
---|
377 | ComPtr<IFloppyDrive> floppyDrive;
|
---|
378 | rc = machine->COMGETTER(FloppyDrive)(floppyDrive.asOutParam());
|
---|
379 | if (SUCCEEDED(rc) && floppyDrive)
|
---|
380 | {
|
---|
381 | BOOL fFloppyEnabled;
|
---|
382 | floppyDrive->COMGETTER(Enabled)(&fFloppyEnabled);
|
---|
383 | Utf8Str pszFloppy = "invalid";
|
---|
384 | if (fFloppyEnabled)
|
---|
385 | {
|
---|
386 | DriveState_T floppyState;
|
---|
387 | floppyDrive->COMGETTER(State)(&floppyState);
|
---|
388 | switch (floppyState)
|
---|
389 | {
|
---|
390 | case DriveState_ImageMounted:
|
---|
391 | {
|
---|
392 | ComPtr<IFloppyImage> floppyImage;
|
---|
393 | rc = floppyDrive->GetImage(floppyImage.asOutParam());
|
---|
394 | if (SUCCEEDED(rc) && floppyImage)
|
---|
395 | {
|
---|
396 | Bstr imagePath;
|
---|
397 | floppyImage->COMGETTER(Location)(imagePath.asOutParam());
|
---|
398 | Guid imageGuid;
|
---|
399 | floppyImage->COMGETTER(Id)(imageGuid.asOutParam());
|
---|
400 | if (details == VMINFO_MACHINEREADABLE)
|
---|
401 | {
|
---|
402 | RTPrintf("FloppyImageUUID=\"%s\"\n", imageGuid.toString().raw());
|
---|
403 | pszFloppy = Utf8StrFmt("%lS", imagePath.raw());
|
---|
404 | }
|
---|
405 | else
|
---|
406 | pszFloppy = Utf8StrFmt("%lS (UUID: %s)", imagePath.raw(), imageGuid.toString().raw());
|
---|
407 | }
|
---|
408 | break;
|
---|
409 | }
|
---|
410 |
|
---|
411 | case DriveState_HostDriveCaptured:
|
---|
412 | {
|
---|
413 | ComPtr<IHostFloppyDrive> hostFloppyDrive;
|
---|
414 | rc = floppyDrive->GetHostDrive(hostFloppyDrive.asOutParam());
|
---|
415 | if (SUCCEEDED(rc) && floppyDrive)
|
---|
416 | {
|
---|
417 | Bstr driveName;
|
---|
418 | hostFloppyDrive->COMGETTER(Name)(driveName.asOutParam());
|
---|
419 | if (details == VMINFO_MACHINEREADABLE)
|
---|
420 | pszFloppy = Utf8StrFmt("host:%lS", driveName.raw());
|
---|
421 | else
|
---|
422 | pszFloppy = Utf8StrFmt("Host drive %lS", driveName.raw());
|
---|
423 | }
|
---|
424 | break;
|
---|
425 | }
|
---|
426 |
|
---|
427 | case DriveState_NotMounted:
|
---|
428 | {
|
---|
429 | pszFloppy = "empty";
|
---|
430 | break;
|
---|
431 | }
|
---|
432 | }
|
---|
433 | }
|
---|
434 | else
|
---|
435 | {
|
---|
436 | pszFloppy = "disabled";
|
---|
437 | }
|
---|
438 | if (details == VMINFO_MACHINEREADABLE)
|
---|
439 | RTPrintf("floppy=\"%s\"\n", pszFloppy.raw());
|
---|
440 | else
|
---|
441 | RTPrintf("Floppy: %s\n", pszFloppy.raw());
|
---|
442 | }
|
---|
443 |
|
---|
444 | /*
|
---|
445 | * SATA.
|
---|
446 | *
|
---|
447 | * Contributed by: James Lucas
|
---|
448 | */
|
---|
449 | #ifdef VBOX_WITH_AHCI
|
---|
450 | ComPtr<IStorageController> SataCtl;
|
---|
451 | bool fSataEnabled = false;
|
---|
452 |
|
---|
453 | rc = machine->GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam());
|
---|
454 | if (SUCCEEDED(rc))
|
---|
455 | fSataEnabled = true;
|
---|
456 |
|
---|
457 | if (details == VMINFO_MACHINEREADABLE)
|
---|
458 | RTPrintf("sata=\"%s\"\n", fSataEnabled ? "on" : "off");
|
---|
459 | else
|
---|
460 | RTPrintf("SATA: %s\n", fSataEnabled ? "enabled" : "disabled");
|
---|
461 |
|
---|
462 | /*
|
---|
463 | * SATA Hard disks
|
---|
464 | */
|
---|
465 | if (fSataEnabled)
|
---|
466 | {
|
---|
467 | ComPtr<IHardDisk> hardDisk;
|
---|
468 | Bstr filePath;
|
---|
469 | ULONG cSataPorts;
|
---|
470 |
|
---|
471 | SataCtl->COMGETTER(PortCount)(&cSataPorts);
|
---|
472 | for (ULONG i = 0; i < cSataPorts; ++ i)
|
---|
473 | {
|
---|
474 | rc = machine->GetHardDisk(Bstr("SATA"), i, 0, hardDisk.asOutParam());
|
---|
475 | if (SUCCEEDED(rc) && hardDisk)
|
---|
476 | {
|
---|
477 | hardDisk->COMGETTER(Location)(filePath.asOutParam());
|
---|
478 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
479 | if (details == VMINFO_MACHINEREADABLE)
|
---|
480 | {
|
---|
481 | RTPrintf("sataport%d=\"%lS\"\n", i, filePath.raw());
|
---|
482 | RTPrintf("SataPortImageUUID%d=\"%s\"\n", i, uuid.toString().raw());
|
---|
483 | }
|
---|
484 | else
|
---|
485 | RTPrintf("SATA %d: %lS (UUID: %s)\n", i, filePath.raw(), uuid.toString().raw());
|
---|
486 | }
|
---|
487 | else
|
---|
488 | {
|
---|
489 | if (details == VMINFO_MACHINEREADABLE)
|
---|
490 | RTPrintf("sata%d=\"none\"\n",i);
|
---|
491 | }
|
---|
492 | }
|
---|
493 | }
|
---|
494 | #endif
|
---|
495 |
|
---|
496 | /*
|
---|
497 | * IDE Hard disks
|
---|
498 | */
|
---|
499 | ComPtr<IStorageController> ideController;
|
---|
500 |
|
---|
501 | rc = machine->GetStorageControllerByName(Bstr("IDE"), ideController.asOutParam());
|
---|
502 | if (SUCCEEDED(rc) && ideController)
|
---|
503 | {
|
---|
504 | StorageControllerType_T enmIdeController;
|
---|
505 | const char *pszIdeController = NULL;
|
---|
506 |
|
---|
507 | rc = ideController->COMGETTER(ControllerType)(&enmIdeController);
|
---|
508 |
|
---|
509 | switch (enmIdeController)
|
---|
510 | {
|
---|
511 | case StorageControllerType_PIIX3:
|
---|
512 | pszIdeController = "PIIX3";
|
---|
513 | break;
|
---|
514 | case StorageControllerType_PIIX4:
|
---|
515 | pszIdeController = "PIIX4";
|
---|
516 | break;
|
---|
517 | case StorageControllerType_ICH6:
|
---|
518 | pszIdeController = "ICH6";
|
---|
519 | break;
|
---|
520 | default:
|
---|
521 | pszIdeController = "unknown";
|
---|
522 | }
|
---|
523 | if (details == VMINFO_MACHINEREADABLE)
|
---|
524 | RTPrintf("idecontroller=\"%s\"\n", pszIdeController);
|
---|
525 | else
|
---|
526 | RTPrintf("IDE Controller: %s\n", pszIdeController);
|
---|
527 | }
|
---|
528 |
|
---|
529 | ComPtr<IHardDisk> hardDisk;
|
---|
530 | Bstr filePath;
|
---|
531 | rc = machine->GetHardDisk(Bstr("IDE"), 0, 0, hardDisk.asOutParam());
|
---|
532 | if (SUCCEEDED(rc) && hardDisk)
|
---|
533 | {
|
---|
534 | hardDisk->COMGETTER(Location)(filePath.asOutParam());
|
---|
535 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
536 | if (details == VMINFO_MACHINEREADABLE)
|
---|
537 | {
|
---|
538 | RTPrintf("hda=\"%lS\"\n", filePath.raw());
|
---|
539 | RTPrintf("HdaImageUUID=\"%s\"\n", uuid.toString().raw());
|
---|
540 | }
|
---|
541 | else
|
---|
542 | RTPrintf("Primary master: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw());
|
---|
543 | }
|
---|
544 | else
|
---|
545 | {
|
---|
546 | if (details == VMINFO_MACHINEREADABLE)
|
---|
547 | RTPrintf("hda=\"none\"\n");
|
---|
548 | }
|
---|
549 | rc = machine->GetHardDisk(Bstr("IDE"), 0, 1, hardDisk.asOutParam());
|
---|
550 | if (SUCCEEDED(rc) && hardDisk)
|
---|
551 | {
|
---|
552 | hardDisk->COMGETTER(Location)(filePath.asOutParam());
|
---|
553 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
554 | if (details == VMINFO_MACHINEREADABLE)
|
---|
555 | {
|
---|
556 | RTPrintf("hdb=\"%lS\"\n", filePath.raw());
|
---|
557 | RTPrintf("HdbImageUUID=\"%s\"\n", uuid.toString().raw());
|
---|
558 | }
|
---|
559 | else
|
---|
560 | RTPrintf("Primary slave: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw());
|
---|
561 | }
|
---|
562 | else
|
---|
563 | {
|
---|
564 | if (details == VMINFO_MACHINEREADABLE)
|
---|
565 | RTPrintf("hdb=\"none\"\n");
|
---|
566 | }
|
---|
567 | rc = machine->GetHardDisk(Bstr("IDE"), 1, 1, hardDisk.asOutParam());
|
---|
568 | if (SUCCEEDED(rc) && hardDisk)
|
---|
569 | {
|
---|
570 | hardDisk->COMGETTER(Location)(filePath.asOutParam());
|
---|
571 | hardDisk->COMGETTER(Id)(uuid.asOutParam());
|
---|
572 | if (details == VMINFO_MACHINEREADABLE)
|
---|
573 | {
|
---|
574 | RTPrintf("hdd=\"%lS\"\n", filePath.raw());
|
---|
575 | RTPrintf("HddImageUUID=\"%s\"\n", uuid.toString().raw());
|
---|
576 | }
|
---|
577 | else
|
---|
578 | RTPrintf("Secondary slave: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw());
|
---|
579 | }
|
---|
580 | else
|
---|
581 | {
|
---|
582 | if (details == VMINFO_MACHINEREADABLE)
|
---|
583 | RTPrintf("hdd=\"none\"\n");
|
---|
584 | }
|
---|
585 | ComPtr<IDVDDrive> dvdDrive;
|
---|
586 | rc = machine->COMGETTER(DVDDrive)(dvdDrive.asOutParam());
|
---|
587 | if (SUCCEEDED(rc) && dvdDrive)
|
---|
588 | {
|
---|
589 | ComPtr<IDVDImage> dvdImage;
|
---|
590 | rc = dvdDrive->GetImage(dvdImage.asOutParam());
|
---|
591 | if (SUCCEEDED(rc) && dvdImage)
|
---|
592 | {
|
---|
593 | rc = dvdImage->COMGETTER(Location)(filePath.asOutParam());
|
---|
594 | if (SUCCEEDED(rc) && filePath)
|
---|
595 | {
|
---|
596 | rc = dvdImage->COMGETTER(Id)(uuid.asOutParam());
|
---|
597 | if (details == VMINFO_MACHINEREADABLE)
|
---|
598 | {
|
---|
599 | RTPrintf("dvd=\"%lS\"\n", filePath.raw());
|
---|
600 | RTPrintf("DvdImageUUID=\"%s\"\n", uuid.toString().raw());
|
---|
601 | }
|
---|
602 | else
|
---|
603 | RTPrintf("DVD: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw());
|
---|
604 | }
|
---|
605 | }
|
---|
606 | else
|
---|
607 | {
|
---|
608 | ComPtr<IHostDVDDrive> hostDVDDrive;
|
---|
609 | rc = dvdDrive->GetHostDrive(hostDVDDrive.asOutParam());
|
---|
610 | if (SUCCEEDED(rc) && hostDVDDrive)
|
---|
611 | {
|
---|
612 | Bstr name;
|
---|
613 | hostDVDDrive->COMGETTER(Name)(name.asOutParam());
|
---|
614 | if (details == VMINFO_MACHINEREADABLE)
|
---|
615 | RTPrintf("dvd=\"host:%lS\"\n", name.raw());
|
---|
616 | else
|
---|
617 | RTPrintf("DVD: Host drive %lS", name.raw());
|
---|
618 | }
|
---|
619 | else
|
---|
620 | {
|
---|
621 | if (details == VMINFO_MACHINEREADABLE)
|
---|
622 | RTPrintf("dvd=\"none\"\n");
|
---|
623 | else
|
---|
624 | RTPrintf("DVD: empty");
|
---|
625 | }
|
---|
626 | BOOL fPassthrough;
|
---|
627 | dvdDrive->COMGETTER(Passthrough)(&fPassthrough);
|
---|
628 | if (details == VMINFO_MACHINEREADABLE)
|
---|
629 | {
|
---|
630 | RTPrintf("dvdpassthrough=\"%s\"\n", fPassthrough ? "on" : "off");
|
---|
631 | }
|
---|
632 | else
|
---|
633 | {
|
---|
634 | if (fPassthrough)
|
---|
635 | RTPrintf(" (passthrough enabled)");
|
---|
636 | RTPrintf("\n");
|
---|
637 | }
|
---|
638 | }
|
---|
639 | }
|
---|
640 |
|
---|
641 | /* get the maximum amount of NICS */
|
---|
642 | ComPtr<ISystemProperties> sysProps;
|
---|
643 | virtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam());
|
---|
644 | ULONG maxNICs = 0;
|
---|
645 | sysProps->COMGETTER(NetworkAdapterCount)(&maxNICs);
|
---|
646 | for (ULONG currentNIC = 0; currentNIC < maxNICs; currentNIC++)
|
---|
647 | {
|
---|
648 | ComPtr<INetworkAdapter> nic;
|
---|
649 | rc = machine->GetNetworkAdapter(currentNIC, nic.asOutParam());
|
---|
650 | if (SUCCEEDED(rc) && nic)
|
---|
651 | {
|
---|
652 | BOOL fEnabled;
|
---|
653 | nic->COMGETTER(Enabled)(&fEnabled);
|
---|
654 | if (!fEnabled)
|
---|
655 | {
|
---|
656 | if (details == VMINFO_MACHINEREADABLE)
|
---|
657 | RTPrintf("nic%d=\"none\"\n", currentNIC + 1);
|
---|
658 | else
|
---|
659 | RTPrintf("NIC %d: disabled\n", currentNIC + 1);
|
---|
660 | }
|
---|
661 | else
|
---|
662 | {
|
---|
663 | Bstr strMACAddress;
|
---|
664 | nic->COMGETTER(MACAddress)(strMACAddress.asOutParam());
|
---|
665 | Utf8Str strAttachment;
|
---|
666 | NetworkAttachmentType_T attachment;
|
---|
667 | nic->COMGETTER(AttachmentType)(&attachment);
|
---|
668 | switch (attachment)
|
---|
669 | {
|
---|
670 | case NetworkAttachmentType_Null:
|
---|
671 | if (details == VMINFO_MACHINEREADABLE)
|
---|
672 | strAttachment = "null";
|
---|
673 | else
|
---|
674 | strAttachment = "none";
|
---|
675 | break;
|
---|
676 | case NetworkAttachmentType_NAT:
|
---|
677 | {
|
---|
678 | Bstr strNetwork;
|
---|
679 | nic->COMGETTER(NATNetwork)(strNetwork.asOutParam());
|
---|
680 | if (details == VMINFO_MACHINEREADABLE)
|
---|
681 | {
|
---|
682 | RTPrintf("natnet%d=\"%lS\"\n", currentNIC + 1, strNetwork.raw());
|
---|
683 | strAttachment = "nat";
|
---|
684 | }
|
---|
685 | else if (!strNetwork.isEmpty())
|
---|
686 | strAttachment = Utf8StrFmt("NAT (%lS)", strNetwork.raw());
|
---|
687 | else
|
---|
688 | strAttachment = "NAT";
|
---|
689 | break;
|
---|
690 | }
|
---|
691 | case NetworkAttachmentType_Bridged:
|
---|
692 | {
|
---|
693 | Bstr strBridgeAdp;
|
---|
694 | nic->COMGETTER(HostInterface)(strBridgeAdp.asOutParam());
|
---|
695 | if (details == VMINFO_MACHINEREADABLE)
|
---|
696 | {
|
---|
697 | RTPrintf("bridgeadapter%d=\"%lS\"\n", currentNIC + 1, strBridgeAdp.raw());
|
---|
698 | strAttachment = "bridged";
|
---|
699 | }
|
---|
700 | else
|
---|
701 | strAttachment = Utf8StrFmt("Bridged Interface '%lS'", strBridgeAdp.raw());
|
---|
702 | break;
|
---|
703 | }
|
---|
704 | case NetworkAttachmentType_Internal:
|
---|
705 | {
|
---|
706 | Bstr strNetwork;
|
---|
707 | nic->COMGETTER(InternalNetwork)(strNetwork.asOutParam());
|
---|
708 | if (details == VMINFO_MACHINEREADABLE)
|
---|
709 | {
|
---|
710 | RTPrintf("intnet%d=\"%lS\"\n", currentNIC + 1, strNetwork.raw());
|
---|
711 | strAttachment = "intnet";
|
---|
712 | }
|
---|
713 | else
|
---|
714 | strAttachment = Utf8StrFmt("Internal Network '%s'", Utf8Str(strNetwork).raw());
|
---|
715 | break;
|
---|
716 | }
|
---|
717 | case NetworkAttachmentType_HostOnly:
|
---|
718 | {
|
---|
719 | Bstr strHostonlyAdp;
|
---|
720 | nic->COMGETTER(HostInterface)(strHostonlyAdp.asOutParam());
|
---|
721 | if (details == VMINFO_MACHINEREADABLE)
|
---|
722 | {
|
---|
723 | RTPrintf("hostonlyadapter%d=\"%lS\"\n", currentNIC + 1, strHostonlyAdp.raw());
|
---|
724 | strAttachment = "hostonly";
|
---|
725 | }
|
---|
726 | else
|
---|
727 | strAttachment = Utf8StrFmt("Host-only Interface '%lS'", strHostonlyAdp.raw());
|
---|
728 | break;
|
---|
729 | }
|
---|
730 | default:
|
---|
731 | strAttachment = "unknown";
|
---|
732 | break;
|
---|
733 | }
|
---|
734 |
|
---|
735 | /* cable connected */
|
---|
736 | BOOL fConnected;
|
---|
737 | nic->COMGETTER(CableConnected)(&fConnected);
|
---|
738 |
|
---|
739 | /* trace stuff */
|
---|
740 | BOOL fTraceEnabled;
|
---|
741 | nic->COMGETTER(TraceEnabled)(&fTraceEnabled);
|
---|
742 | Bstr traceFile;
|
---|
743 | nic->COMGETTER(TraceFile)(traceFile.asOutParam());
|
---|
744 |
|
---|
745 | /* NIC type */
|
---|
746 | Utf8Str strNICType;
|
---|
747 | NetworkAdapterType_T NICType;
|
---|
748 | nic->COMGETTER(AdapterType)(&NICType);
|
---|
749 | switch (NICType) {
|
---|
750 | case NetworkAdapterType_Am79C970A:
|
---|
751 | strNICType = "Am79C970A";
|
---|
752 | break;
|
---|
753 | case NetworkAdapterType_Am79C973:
|
---|
754 | strNICType = "Am79C973";
|
---|
755 | break;
|
---|
756 | #ifdef VBOX_WITH_E1000
|
---|
757 | case NetworkAdapterType_I82540EM:
|
---|
758 | strNICType = "82540EM";
|
---|
759 | break;
|
---|
760 | case NetworkAdapterType_I82543GC:
|
---|
761 | strNICType = "82543GC";
|
---|
762 | break;
|
---|
763 | #endif
|
---|
764 | default:
|
---|
765 | strNICType = "unknown";
|
---|
766 | break;
|
---|
767 | }
|
---|
768 |
|
---|
769 | /* reported line speed */
|
---|
770 | ULONG ulLineSpeed;
|
---|
771 | nic->COMGETTER(LineSpeed)(&ulLineSpeed);
|
---|
772 |
|
---|
773 | if (details == VMINFO_MACHINEREADABLE)
|
---|
774 | {
|
---|
775 | RTPrintf("macaddress%d=\"%lS\"\n", currentNIC + 1, strMACAddress.raw());
|
---|
776 | RTPrintf("cableconnected%d=\"%s\"\n", currentNIC + 1, fConnected ? "on" : "off");
|
---|
777 | RTPrintf("nic%d=\"%s\"\n", currentNIC + 1, strAttachment.raw());
|
---|
778 | }
|
---|
779 | else
|
---|
780 | RTPrintf("NIC %d: MAC: %lS, Attachment: %s, Cable connected: %s, Trace: %s (file: %lS), Type: %s, Reported speed: %d Mbps\n",
|
---|
781 | currentNIC + 1, strMACAddress.raw(), strAttachment.raw(),
|
---|
782 | fConnected ? "on" : "off",
|
---|
783 | fTraceEnabled ? "on" : "off",
|
---|
784 | traceFile.isEmpty() ? Bstr("none").raw() : traceFile.raw(),
|
---|
785 | strNICType.raw(),
|
---|
786 | ulLineSpeed / 1000);
|
---|
787 | }
|
---|
788 | }
|
---|
789 | }
|
---|
790 |
|
---|
791 | /* get the maximum amount of UARTs */
|
---|
792 | ULONG maxUARTs = 0;
|
---|
793 | sysProps->COMGETTER(SerialPortCount)(&maxUARTs);
|
---|
794 | for (ULONG currentUART = 0; currentUART < maxUARTs; currentUART++)
|
---|
795 | {
|
---|
796 | ComPtr<ISerialPort> uart;
|
---|
797 | rc = machine->GetSerialPort(currentUART, uart.asOutParam());
|
---|
798 | if (SUCCEEDED(rc) && uart)
|
---|
799 | {
|
---|
800 | BOOL fEnabled;
|
---|
801 | uart->COMGETTER(Enabled)(&fEnabled);
|
---|
802 | if (!fEnabled)
|
---|
803 | {
|
---|
804 | if (details == VMINFO_MACHINEREADABLE)
|
---|
805 | RTPrintf("uart%d=\"off\"\n", currentUART + 1);
|
---|
806 | else
|
---|
807 | RTPrintf("UART %d: disabled\n", currentUART + 1);
|
---|
808 | }
|
---|
809 | else
|
---|
810 | {
|
---|
811 | ULONG ulIRQ, ulIOBase;
|
---|
812 | PortMode_T HostMode;
|
---|
813 | Bstr path;
|
---|
814 | BOOL fServer;
|
---|
815 | uart->COMGETTER(IRQ)(&ulIRQ);
|
---|
816 | uart->COMGETTER(IOBase)(&ulIOBase);
|
---|
817 | uart->COMGETTER(Path)(path.asOutParam());
|
---|
818 | uart->COMGETTER(Server)(&fServer);
|
---|
819 | uart->COMGETTER(HostMode)(&HostMode);
|
---|
820 |
|
---|
821 | if (details == VMINFO_MACHINEREADABLE)
|
---|
822 | RTPrintf("uart%d=\"%#06x,%d\"\n", currentUART + 1,
|
---|
823 | ulIOBase, ulIRQ);
|
---|
824 | else
|
---|
825 | RTPrintf("UART %d: I/O base: 0x%04x, IRQ: %d",
|
---|
826 | currentUART + 1, ulIOBase, ulIRQ);
|
---|
827 | switch (HostMode)
|
---|
828 | {
|
---|
829 | default:
|
---|
830 | case PortMode_Disconnected:
|
---|
831 | if (details == VMINFO_MACHINEREADABLE)
|
---|
832 | RTPrintf("uartmode%d=\"disconnected\"\n", currentUART + 1);
|
---|
833 | else
|
---|
834 | RTPrintf(", disconnected\n");
|
---|
835 | break;
|
---|
836 | case PortMode_HostPipe:
|
---|
837 | if (details == VMINFO_MACHINEREADABLE)
|
---|
838 | RTPrintf("uartmode%d=\"%s,%lS\"\n", currentUART + 1,
|
---|
839 | fServer ? "server" : "client", path.raw());
|
---|
840 | else
|
---|
841 | RTPrintf(", attached to pipe (%s) '%lS'\n",
|
---|
842 | fServer ? "server" : "client", path.raw());
|
---|
843 | break;
|
---|
844 | case PortMode_HostDevice:
|
---|
845 | if (details == VMINFO_MACHINEREADABLE)
|
---|
846 | RTPrintf("uartmode%d=\"%lS\"\n", currentUART + 1,
|
---|
847 | path.raw());
|
---|
848 | else
|
---|
849 | RTPrintf(", attached to device '%lS'\n", path.raw());
|
---|
850 | break;
|
---|
851 | }
|
---|
852 | }
|
---|
853 | }
|
---|
854 | }
|
---|
855 |
|
---|
856 | ComPtr<IAudioAdapter> AudioAdapter;
|
---|
857 | rc = machine->COMGETTER(AudioAdapter)(AudioAdapter.asOutParam());
|
---|
858 | if (SUCCEEDED(rc))
|
---|
859 | {
|
---|
860 | const char *pszDrv = "Unknown";
|
---|
861 | const char *pszCtrl = "Unknown";
|
---|
862 | BOOL fEnabled;
|
---|
863 | rc = AudioAdapter->COMGETTER(Enabled)(&fEnabled);
|
---|
864 | if (SUCCEEDED(rc) && fEnabled)
|
---|
865 | {
|
---|
866 | AudioDriverType_T enmDrvType;
|
---|
867 | rc = AudioAdapter->COMGETTER(AudioDriver)(&enmDrvType);
|
---|
868 | switch (enmDrvType)
|
---|
869 | {
|
---|
870 | case AudioDriverType_Null:
|
---|
871 | if (details == VMINFO_MACHINEREADABLE)
|
---|
872 | pszDrv = "null";
|
---|
873 | else
|
---|
874 | pszDrv = "Null";
|
---|
875 | break;
|
---|
876 | case AudioDriverType_WinMM:
|
---|
877 | if (details == VMINFO_MACHINEREADABLE)
|
---|
878 | pszDrv = "winmm";
|
---|
879 | else
|
---|
880 | pszDrv = "WINMM";
|
---|
881 | break;
|
---|
882 | case AudioDriverType_DirectSound:
|
---|
883 | if (details == VMINFO_MACHINEREADABLE)
|
---|
884 | pszDrv = "dsound";
|
---|
885 | else
|
---|
886 | pszDrv = "DSOUND";
|
---|
887 | break;
|
---|
888 | case AudioDriverType_OSS:
|
---|
889 | if (details == VMINFO_MACHINEREADABLE)
|
---|
890 | pszDrv = "oss";
|
---|
891 | else
|
---|
892 | pszDrv = "OSS";
|
---|
893 | break;
|
---|
894 | case AudioDriverType_ALSA:
|
---|
895 | if (details == VMINFO_MACHINEREADABLE)
|
---|
896 | pszDrv = "alsa";
|
---|
897 | else
|
---|
898 | pszDrv = "ALSA";
|
---|
899 | break;
|
---|
900 | case AudioDriverType_Pulse:
|
---|
901 | if (details == VMINFO_MACHINEREADABLE)
|
---|
902 | pszDrv = "pulse";
|
---|
903 | else
|
---|
904 | pszDrv = "PulseAudio";
|
---|
905 | break;
|
---|
906 | case AudioDriverType_CoreAudio:
|
---|
907 | if (details == VMINFO_MACHINEREADABLE)
|
---|
908 | pszDrv = "coreaudio";
|
---|
909 | else
|
---|
910 | pszDrv = "CoreAudio";
|
---|
911 | break;
|
---|
912 | case AudioDriverType_SolAudio:
|
---|
913 | if (details == VMINFO_MACHINEREADABLE)
|
---|
914 | pszDrv = "solaudio";
|
---|
915 | else
|
---|
916 | pszDrv = "SolAudio";
|
---|
917 | break;
|
---|
918 | default:
|
---|
919 | if (details == VMINFO_MACHINEREADABLE)
|
---|
920 | pszDrv = "unknown";
|
---|
921 | break;
|
---|
922 | }
|
---|
923 | AudioControllerType_T enmCtrlType;
|
---|
924 | rc = AudioAdapter->COMGETTER(AudioController)(&enmCtrlType);
|
---|
925 | switch (enmCtrlType)
|
---|
926 | {
|
---|
927 | case AudioControllerType_AC97:
|
---|
928 | if (details == VMINFO_MACHINEREADABLE)
|
---|
929 | pszCtrl = "ac97";
|
---|
930 | else
|
---|
931 | pszCtrl = "AC97";
|
---|
932 | break;
|
---|
933 | case AudioControllerType_SB16:
|
---|
934 | if (details == VMINFO_MACHINEREADABLE)
|
---|
935 | pszCtrl = "sb16";
|
---|
936 | else
|
---|
937 | pszCtrl = "SB16";
|
---|
938 | break;
|
---|
939 | }
|
---|
940 | }
|
---|
941 | else
|
---|
942 | fEnabled = FALSE;
|
---|
943 | if (details == VMINFO_MACHINEREADABLE)
|
---|
944 | {
|
---|
945 | if (fEnabled)
|
---|
946 | RTPrintf("audio=\"%s\"\n", pszDrv);
|
---|
947 | else
|
---|
948 | RTPrintf("audio=\"none\"\n");
|
---|
949 | }
|
---|
950 | else
|
---|
951 | RTPrintf("Audio: %s (Driver: %s, Controller: %s)\n",
|
---|
952 | fEnabled ? "enabled" : "disabled", pszDrv, pszCtrl);
|
---|
953 | }
|
---|
954 |
|
---|
955 | /* Shared clipboard */
|
---|
956 | {
|
---|
957 | const char *psz = "Unknown";
|
---|
958 | ClipboardMode_T enmMode;
|
---|
959 | rc = machine->COMGETTER(ClipboardMode)(&enmMode);
|
---|
960 | switch (enmMode)
|
---|
961 | {
|
---|
962 | case ClipboardMode_Disabled:
|
---|
963 | if (details == VMINFO_MACHINEREADABLE)
|
---|
964 | psz = "disabled";
|
---|
965 | else
|
---|
966 | psz = "disabled";
|
---|
967 | break;
|
---|
968 | case ClipboardMode_HostToGuest:
|
---|
969 | if (details == VMINFO_MACHINEREADABLE)
|
---|
970 | psz = "hosttoguest";
|
---|
971 | else
|
---|
972 | psz = "HostToGuest";
|
---|
973 | break;
|
---|
974 | case ClipboardMode_GuestToHost:
|
---|
975 | if (details == VMINFO_MACHINEREADABLE)
|
---|
976 | psz = "guesttohost";
|
---|
977 | else
|
---|
978 | psz = "GuestToHost";
|
---|
979 | break;
|
---|
980 | case ClipboardMode_Bidirectional:
|
---|
981 | if (details == VMINFO_MACHINEREADABLE)
|
---|
982 | psz = "bidirectional";
|
---|
983 | else
|
---|
984 | psz = "Bidirectional";
|
---|
985 | break;
|
---|
986 | default:
|
---|
987 | if (details == VMINFO_MACHINEREADABLE)
|
---|
988 | psz = "unknown";
|
---|
989 | break;
|
---|
990 | }
|
---|
991 | if (details == VMINFO_MACHINEREADABLE)
|
---|
992 | RTPrintf("clipboard=\"%s\"\n", psz);
|
---|
993 | else
|
---|
994 | RTPrintf("Clipboard Mode: %s\n", psz);
|
---|
995 | }
|
---|
996 |
|
---|
997 | if (console)
|
---|
998 | {
|
---|
999 | ComPtr<IDisplay> display;
|
---|
1000 | CHECK_ERROR_RET(console, COMGETTER(Display)(display.asOutParam()), rc);
|
---|
1001 | do
|
---|
1002 | {
|
---|
1003 | ULONG xRes, yRes, bpp;
|
---|
1004 | rc = display->COMGETTER(Width)(&xRes);
|
---|
1005 | if (rc == E_ACCESSDENIED)
|
---|
1006 | break; /* VM not powered up */
|
---|
1007 | if (FAILED(rc))
|
---|
1008 | {
|
---|
1009 | com::ErrorInfo info (display);
|
---|
1010 | GluePrintErrorInfo(info);
|
---|
1011 | return rc;
|
---|
1012 | }
|
---|
1013 | rc = display->COMGETTER(Height)(&yRes);
|
---|
1014 | if (rc == E_ACCESSDENIED)
|
---|
1015 | break; /* VM not powered up */
|
---|
1016 | if (FAILED(rc))
|
---|
1017 | {
|
---|
1018 | com::ErrorInfo info (display);
|
---|
1019 | GluePrintErrorInfo(info);
|
---|
1020 | return rc;
|
---|
1021 | }
|
---|
1022 | rc = display->COMGETTER(BitsPerPixel)(&bpp);
|
---|
1023 | if (rc == E_ACCESSDENIED)
|
---|
1024 | break; /* VM not powered up */
|
---|
1025 | if (FAILED(rc))
|
---|
1026 | {
|
---|
1027 | com::ErrorInfo info (display);
|
---|
1028 | GluePrintErrorInfo(info);
|
---|
1029 | return rc;
|
---|
1030 | }
|
---|
1031 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1032 | RTPrintf("VideoMode=\"%d,%d,%d\"\n", xRes, yRes, bpp);
|
---|
1033 | else
|
---|
1034 | RTPrintf("Video mode: %dx%dx%d\n", xRes, yRes, bpp);
|
---|
1035 | }
|
---|
1036 | while (0);
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 | /*
|
---|
1040 | * VRDP
|
---|
1041 | */
|
---|
1042 | ComPtr<IVRDPServer> vrdpServer;
|
---|
1043 | rc = machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
|
---|
1044 | if (SUCCEEDED(rc) && vrdpServer)
|
---|
1045 | {
|
---|
1046 | BOOL fEnabled = false;
|
---|
1047 | vrdpServer->COMGETTER(Enabled)(&fEnabled);
|
---|
1048 | if (fEnabled)
|
---|
1049 | {
|
---|
1050 | ULONG port;
|
---|
1051 | vrdpServer->COMGETTER(Port)(&port);
|
---|
1052 | Bstr address;
|
---|
1053 | vrdpServer->COMGETTER(NetAddress)(address.asOutParam());
|
---|
1054 | BOOL fMultiCon;
|
---|
1055 | vrdpServer->COMGETTER(AllowMultiConnection)(&fMultiCon);
|
---|
1056 | BOOL fReuseCon;
|
---|
1057 | vrdpServer->COMGETTER(ReuseSingleConnection)(&fReuseCon);
|
---|
1058 | VRDPAuthType_T vrdpAuthType;
|
---|
1059 | const char *strAuthType;
|
---|
1060 | vrdpServer->COMGETTER(AuthType)(&vrdpAuthType);
|
---|
1061 | switch (vrdpAuthType)
|
---|
1062 | {
|
---|
1063 | case VRDPAuthType_Null:
|
---|
1064 | strAuthType = "null";
|
---|
1065 | break;
|
---|
1066 | case VRDPAuthType_External:
|
---|
1067 | strAuthType = "external";
|
---|
1068 | break;
|
---|
1069 | case VRDPAuthType_Guest:
|
---|
1070 | strAuthType = "guest";
|
---|
1071 | break;
|
---|
1072 | default:
|
---|
1073 | strAuthType = "unknown";
|
---|
1074 | break;
|
---|
1075 | }
|
---|
1076 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1077 | {
|
---|
1078 | RTPrintf("vrdp=\"on\"\n");
|
---|
1079 | RTPrintf("vrdpport=%d\n", port);
|
---|
1080 | RTPrintf("vrdpaddress=\"%lS\"\n", address.raw());
|
---|
1081 | RTPrintf("vrdpauthtype=\"%s\"\n", strAuthType);
|
---|
1082 | RTPrintf("vrdpmulticon=\"%s\"\n", fMultiCon ? "on" : "off");
|
---|
1083 | RTPrintf("vrdpreusecon=\"%s\"\n", fReuseCon ? "on" : "off");
|
---|
1084 | }
|
---|
1085 | else
|
---|
1086 | {
|
---|
1087 | if (address.isEmpty())
|
---|
1088 | address = "0.0.0.0";
|
---|
1089 | RTPrintf("VRDP: enabled (Address %lS, Port %d, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n", address.raw(), port, fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType);
|
---|
1090 | }
|
---|
1091 | }
|
---|
1092 | else
|
---|
1093 | {
|
---|
1094 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1095 | RTPrintf("vrdp=\"off\"\n");
|
---|
1096 | else
|
---|
1097 | RTPrintf("VRDP: disabled\n");
|
---|
1098 | }
|
---|
1099 | }
|
---|
1100 |
|
---|
1101 | /*
|
---|
1102 | * USB.
|
---|
1103 | */
|
---|
1104 | ComPtr<IUSBController> USBCtl;
|
---|
1105 | rc = machine->COMGETTER(USBController)(USBCtl.asOutParam());
|
---|
1106 | if (SUCCEEDED(rc))
|
---|
1107 | {
|
---|
1108 | BOOL fEnabled;
|
---|
1109 | rc = USBCtl->COMGETTER(Enabled)(&fEnabled);
|
---|
1110 | if (FAILED(rc))
|
---|
1111 | fEnabled = false;
|
---|
1112 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1113 | RTPrintf("usb=\"%s\"\n", fEnabled ? "on" : "off");
|
---|
1114 | else
|
---|
1115 | RTPrintf("USB: %s\n", fEnabled ? "enabled" : "disabled");
|
---|
1116 |
|
---|
1117 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1118 | RTPrintf("\nUSB Device Filters:\n\n");
|
---|
1119 |
|
---|
1120 | SafeIfaceArray <IUSBDeviceFilter> Coll;
|
---|
1121 | CHECK_ERROR_RET (USBCtl, COMGETTER(DeviceFilters)(ComSafeArrayAsOutParam(Coll)), rc);
|
---|
1122 |
|
---|
1123 | if (Coll.size() == 0)
|
---|
1124 | {
|
---|
1125 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1126 | RTPrintf("<none>\n\n");
|
---|
1127 | }
|
---|
1128 | else
|
---|
1129 | {
|
---|
1130 | for (size_t index = 0; index < Coll.size(); ++index)
|
---|
1131 | {
|
---|
1132 | ComPtr<IUSBDeviceFilter> DevPtr = Coll[index];
|
---|
1133 |
|
---|
1134 | /* Query info. */
|
---|
1135 |
|
---|
1136 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1137 | RTPrintf("Index: %zu\n", index);
|
---|
1138 |
|
---|
1139 | BOOL bActive = FALSE;
|
---|
1140 | CHECK_ERROR_RET (DevPtr, COMGETTER (Active) (&bActive), rc);
|
---|
1141 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1142 | RTPrintf("USBFilterActive%zu=\"%s\"\n", index + 1, bActive ? "on" : "off");
|
---|
1143 | else
|
---|
1144 | RTPrintf("Active: %s\n", bActive ? "yes" : "no");
|
---|
1145 |
|
---|
1146 | Bstr bstr;
|
---|
1147 | CHECK_ERROR_RET (DevPtr, COMGETTER (Name) (bstr.asOutParam()), rc);
|
---|
1148 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1149 | RTPrintf("USBFilterName%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1150 | else
|
---|
1151 | RTPrintf("Name: %lS\n", bstr.raw());
|
---|
1152 | CHECK_ERROR_RET (DevPtr, COMGETTER (VendorId) (bstr.asOutParam()), rc);
|
---|
1153 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1154 | RTPrintf("USBFilterVendorId%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1155 | else
|
---|
1156 | RTPrintf("VendorId: %lS\n", bstr.raw());
|
---|
1157 | CHECK_ERROR_RET (DevPtr, COMGETTER (ProductId) (bstr.asOutParam()), rc);
|
---|
1158 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1159 | RTPrintf("USBFilterProductId%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1160 | else
|
---|
1161 | RTPrintf("ProductId: %lS\n", bstr.raw());
|
---|
1162 | CHECK_ERROR_RET (DevPtr, COMGETTER (Revision) (bstr.asOutParam()), rc);
|
---|
1163 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1164 | RTPrintf("USBFilterRevision%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1165 | else
|
---|
1166 | RTPrintf("Revision: %lS\n", bstr.raw());
|
---|
1167 | CHECK_ERROR_RET (DevPtr, COMGETTER (Manufacturer) (bstr.asOutParam()), rc);
|
---|
1168 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1169 | RTPrintf("USBFilterManufacturer%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1170 | else
|
---|
1171 | RTPrintf("Manufacturer: %lS\n", bstr.raw());
|
---|
1172 | CHECK_ERROR_RET (DevPtr, COMGETTER (Product) (bstr.asOutParam()), rc);
|
---|
1173 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1174 | RTPrintf("USBFilterProduct%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1175 | else
|
---|
1176 | RTPrintf("Product: %lS\n", bstr.raw());
|
---|
1177 | CHECK_ERROR_RET (DevPtr, COMGETTER (Remote) (bstr.asOutParam()), rc);
|
---|
1178 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1179 | RTPrintf("USBFilterRemote%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1180 | else
|
---|
1181 | RTPrintf("Remote: %lS\n", bstr.raw());
|
---|
1182 | CHECK_ERROR_RET (DevPtr, COMGETTER (SerialNumber) (bstr.asOutParam()), rc);
|
---|
1183 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1184 | RTPrintf("USBFilterSerialNumber%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1185 | else
|
---|
1186 | RTPrintf("Serial Number: %lS\n", bstr.raw());
|
---|
1187 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1188 | {
|
---|
1189 | ULONG fMaskedIfs;
|
---|
1190 | CHECK_ERROR_RET (DevPtr, COMGETTER (MaskedInterfaces) (&fMaskedIfs), rc);
|
---|
1191 | if (fMaskedIfs)
|
---|
1192 | RTPrintf("Masked Interfaces: 0x%08x\n", fMaskedIfs);
|
---|
1193 | RTPrintf("\n");
|
---|
1194 | }
|
---|
1195 | }
|
---|
1196 | }
|
---|
1197 |
|
---|
1198 | if (console)
|
---|
1199 | {
|
---|
1200 | /* scope */
|
---|
1201 | {
|
---|
1202 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1203 | RTPrintf("Available remote USB devices:\n\n");
|
---|
1204 |
|
---|
1205 | SafeIfaceArray <IHostUSBDevice> coll;
|
---|
1206 | CHECK_ERROR_RET (console, COMGETTER(RemoteUSBDevices) (ComSafeArrayAsOutParam(coll)), rc);
|
---|
1207 |
|
---|
1208 | if (coll.size() == 0)
|
---|
1209 | {
|
---|
1210 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1211 | RTPrintf("<none>\n\n");
|
---|
1212 | }
|
---|
1213 | else
|
---|
1214 | {
|
---|
1215 | for (size_t index = 0; index < coll.size(); ++index)
|
---|
1216 | {
|
---|
1217 | ComPtr <IHostUSBDevice> dev = coll[index];
|
---|
1218 |
|
---|
1219 | /* Query info. */
|
---|
1220 | Guid id;
|
---|
1221 | CHECK_ERROR_RET (dev, COMGETTER(Id)(id.asOutParam()), rc);
|
---|
1222 | USHORT usVendorId;
|
---|
1223 | CHECK_ERROR_RET (dev, COMGETTER(VendorId)(&usVendorId), rc);
|
---|
1224 | USHORT usProductId;
|
---|
1225 | CHECK_ERROR_RET (dev, COMGETTER(ProductId)(&usProductId), rc);
|
---|
1226 | USHORT bcdRevision;
|
---|
1227 | CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), rc);
|
---|
1228 |
|
---|
1229 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1230 | RTPrintf("USBRemoteUUID%zu=\"%S\"\n"
|
---|
1231 | "USBRemoteVendorId%zu=\"%#06x\"\n"
|
---|
1232 | "USBRemoteProductId%zu=\"%#06x\"\n"
|
---|
1233 | "USBRemoteRevision%zu=\"%#04x%02x\"\n",
|
---|
1234 | index + 1, id.toString().raw(),
|
---|
1235 | index + 1, usVendorId,
|
---|
1236 | index + 1, usProductId,
|
---|
1237 | index + 1, bcdRevision >> 8, bcdRevision & 0xff);
|
---|
1238 | else
|
---|
1239 | RTPrintf("UUID: %S\n"
|
---|
1240 | "VendorId: 0x%04x (%04X)\n"
|
---|
1241 | "ProductId: 0x%04x (%04X)\n"
|
---|
1242 | "Revision: %u.%u (%02u%02u)\n",
|
---|
1243 | id.toString().raw(),
|
---|
1244 | usVendorId, usVendorId, usProductId, usProductId,
|
---|
1245 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
1246 | bcdRevision >> 8, bcdRevision & 0xff);
|
---|
1247 |
|
---|
1248 | /* optional stuff. */
|
---|
1249 | Bstr bstr;
|
---|
1250 | CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc);
|
---|
1251 | if (!bstr.isEmpty())
|
---|
1252 | {
|
---|
1253 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1254 | RTPrintf("USBRemoteManufacturer%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1255 | else
|
---|
1256 | RTPrintf("Manufacturer: %lS\n", bstr.raw());
|
---|
1257 | }
|
---|
1258 | CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), rc);
|
---|
1259 | if (!bstr.isEmpty())
|
---|
1260 | {
|
---|
1261 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1262 | RTPrintf("USBRemoteProduct%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1263 | else
|
---|
1264 | RTPrintf("Product: %lS\n", bstr.raw());
|
---|
1265 | }
|
---|
1266 | CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc);
|
---|
1267 | if (!bstr.isEmpty())
|
---|
1268 | {
|
---|
1269 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1270 | RTPrintf("USBRemoteSerialNumber%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1271 | else
|
---|
1272 | RTPrintf("SerialNumber: %lS\n", bstr.raw());
|
---|
1273 | }
|
---|
1274 | CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), rc);
|
---|
1275 | if (!bstr.isEmpty())
|
---|
1276 | {
|
---|
1277 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1278 | RTPrintf("USBRemoteAddress%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1279 | else
|
---|
1280 | RTPrintf("Address: %lS\n", bstr.raw());
|
---|
1281 | }
|
---|
1282 |
|
---|
1283 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1284 | RTPrintf("\n");
|
---|
1285 | }
|
---|
1286 | }
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 | /* scope */
|
---|
1290 | {
|
---|
1291 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1292 | RTPrintf ("Currently Attached USB Devices:\n\n");
|
---|
1293 |
|
---|
1294 | SafeIfaceArray <IUSBDevice> coll;
|
---|
1295 | CHECK_ERROR_RET (console, COMGETTER(USBDevices) (ComSafeArrayAsOutParam(coll)), rc);
|
---|
1296 |
|
---|
1297 | if (coll.size() == 0)
|
---|
1298 | {
|
---|
1299 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1300 | RTPrintf("<none>\n\n");
|
---|
1301 | }
|
---|
1302 | else
|
---|
1303 | {
|
---|
1304 | for (size_t index = 0; index < coll.size(); ++index)
|
---|
1305 | {
|
---|
1306 | ComPtr <IUSBDevice> dev = coll[index];
|
---|
1307 |
|
---|
1308 | /* Query info. */
|
---|
1309 | Guid id;
|
---|
1310 | CHECK_ERROR_RET (dev, COMGETTER(Id)(id.asOutParam()), rc);
|
---|
1311 | USHORT usVendorId;
|
---|
1312 | CHECK_ERROR_RET (dev, COMGETTER(VendorId)(&usVendorId), rc);
|
---|
1313 | USHORT usProductId;
|
---|
1314 | CHECK_ERROR_RET (dev, COMGETTER(ProductId)(&usProductId), rc);
|
---|
1315 | USHORT bcdRevision;
|
---|
1316 | CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), rc);
|
---|
1317 |
|
---|
1318 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1319 | RTPrintf("USBAttachedUUID%zu=\"%S\"\n"
|
---|
1320 | "USBAttachedVendorId%zu=\"%#06x\"\n"
|
---|
1321 | "USBAttachedProductId%zu=\"%#06x\"\n"
|
---|
1322 | "USBAttachedRevision%zu=\"%#04x%02x\"\n",
|
---|
1323 | index + 1, id.toString().raw(),
|
---|
1324 | index + 1, usVendorId,
|
---|
1325 | index + 1, usProductId,
|
---|
1326 | index + 1, bcdRevision >> 8, bcdRevision & 0xff);
|
---|
1327 | else
|
---|
1328 | RTPrintf("UUID: %S\n"
|
---|
1329 | "VendorId: 0x%04x (%04X)\n"
|
---|
1330 | "ProductId: 0x%04x (%04X)\n"
|
---|
1331 | "Revision: %u.%u (%02u%02u)\n",
|
---|
1332 | id.toString().raw(),
|
---|
1333 | usVendorId, usVendorId, usProductId, usProductId,
|
---|
1334 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
1335 | bcdRevision >> 8, bcdRevision & 0xff);
|
---|
1336 |
|
---|
1337 | /* optional stuff. */
|
---|
1338 | Bstr bstr;
|
---|
1339 | CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc);
|
---|
1340 | if (!bstr.isEmpty())
|
---|
1341 | {
|
---|
1342 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1343 | RTPrintf("USBAttachedManufacturer%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1344 | else
|
---|
1345 | RTPrintf("Manufacturer: %lS\n", bstr.raw());
|
---|
1346 | }
|
---|
1347 | CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), rc);
|
---|
1348 | if (!bstr.isEmpty())
|
---|
1349 | {
|
---|
1350 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1351 | RTPrintf("USBAttachedProduct%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1352 | else
|
---|
1353 | RTPrintf("Product: %lS\n", bstr.raw());
|
---|
1354 | }
|
---|
1355 | CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc);
|
---|
1356 | if (!bstr.isEmpty())
|
---|
1357 | {
|
---|
1358 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1359 | RTPrintf("USBAttachedSerialNumber%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1360 | else
|
---|
1361 | RTPrintf("SerialNumber: %lS\n", bstr.raw());
|
---|
1362 | }
|
---|
1363 | CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), rc);
|
---|
1364 | if (!bstr.isEmpty())
|
---|
1365 | {
|
---|
1366 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1367 | RTPrintf("USBAttachedAddress%zu=\"%lS\"\n", index + 1, bstr.raw());
|
---|
1368 | else
|
---|
1369 | RTPrintf("Address: %lS\n", bstr.raw());
|
---|
1370 | }
|
---|
1371 |
|
---|
1372 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1373 | RTPrintf("\n");
|
---|
1374 | }
|
---|
1375 | }
|
---|
1376 | }
|
---|
1377 | }
|
---|
1378 | } /* USB */
|
---|
1379 |
|
---|
1380 | /*
|
---|
1381 | * Shared folders
|
---|
1382 | */
|
---|
1383 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1384 | RTPrintf("Shared folders: ");
|
---|
1385 | uint32_t numSharedFolders = 0;
|
---|
1386 | #if 0 // not yet implemented
|
---|
1387 | /* globally shared folders first */
|
---|
1388 | {
|
---|
1389 | SafeIfaceArray <ISharedFolder> sfColl;
|
---|
1390 | CHECK_ERROR_RET(virtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(sfColl)), rc);
|
---|
1391 | for (size_t i = 0; i < sfColl.size(); ++i)
|
---|
1392 | {
|
---|
1393 | ComPtr<ISharedFolder> sf = sfColl[i];
|
---|
1394 | Bstr name, hostPath;
|
---|
1395 | sf->COMGETTER(Name)(name.asOutParam());
|
---|
1396 | sf->COMGETTER(HostPath)(hostPath.asOutParam());
|
---|
1397 | RTPrintf("Name: '%lS', Host path: '%lS' (global mapping)\n", name.raw(), hostPath.raw());
|
---|
1398 | ++numSharedFolders;
|
---|
1399 | }
|
---|
1400 | }
|
---|
1401 | #endif
|
---|
1402 | /* now VM mappings */
|
---|
1403 | {
|
---|
1404 | com::SafeIfaceArray <ISharedFolder> folders;
|
---|
1405 |
|
---|
1406 | CHECK_ERROR_RET(machine, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);
|
---|
1407 |
|
---|
1408 | for (size_t i = 0; i < folders.size(); ++i)
|
---|
1409 | {
|
---|
1410 | ComPtr <ISharedFolder> sf = folders[i];
|
---|
1411 |
|
---|
1412 | Bstr name, hostPath;
|
---|
1413 | BOOL writable;
|
---|
1414 | sf->COMGETTER(Name)(name.asOutParam());
|
---|
1415 | sf->COMGETTER(HostPath)(hostPath.asOutParam());
|
---|
1416 | sf->COMGETTER(Writable)(&writable);
|
---|
1417 | if (!numSharedFolders && details != VMINFO_MACHINEREADABLE)
|
---|
1418 | RTPrintf("\n\n");
|
---|
1419 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1420 | {
|
---|
1421 | RTPrintf("SharedFolderNameMachineMapping%zu=\"%lS\"\n", i + 1,
|
---|
1422 | name.raw());
|
---|
1423 | RTPrintf("SharedFolderPathMachineMapping%zu=\"%lS\"\n", i + 1,
|
---|
1424 | hostPath.raw());
|
---|
1425 | }
|
---|
1426 | else
|
---|
1427 | RTPrintf("Name: '%lS', Host path: '%lS' (machine mapping), %s\n",
|
---|
1428 | name.raw(), hostPath.raw(), writable ? "writable" : "readonly");
|
---|
1429 | ++numSharedFolders;
|
---|
1430 | }
|
---|
1431 | }
|
---|
1432 | /* transient mappings */
|
---|
1433 | if (console)
|
---|
1434 | {
|
---|
1435 | com::SafeIfaceArray <ISharedFolder> folders;
|
---|
1436 |
|
---|
1437 | CHECK_ERROR_RET(console, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);
|
---|
1438 |
|
---|
1439 | for (size_t i = 0; i < folders.size(); ++i)
|
---|
1440 | {
|
---|
1441 | ComPtr <ISharedFolder> sf = folders[i];
|
---|
1442 |
|
---|
1443 | Bstr name, hostPath;
|
---|
1444 | sf->COMGETTER(Name)(name.asOutParam());
|
---|
1445 | sf->COMGETTER(HostPath)(hostPath.asOutParam());
|
---|
1446 | if (!numSharedFolders && details != VMINFO_MACHINEREADABLE)
|
---|
1447 | RTPrintf("\n\n");
|
---|
1448 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1449 | {
|
---|
1450 | RTPrintf("SharedFolderNameTransientMapping%zu=\"%lS\"\n", i + 1,
|
---|
1451 | name.raw());
|
---|
1452 | RTPrintf("SharedFolderPathTransientMapping%zu=\"%lS\"\n", i + 1,
|
---|
1453 | hostPath.raw());
|
---|
1454 | }
|
---|
1455 | else
|
---|
1456 | RTPrintf("Name: '%lS', Host path: '%lS' (transient mapping)\n", name.raw(), hostPath.raw());
|
---|
1457 | ++numSharedFolders;
|
---|
1458 | }
|
---|
1459 | }
|
---|
1460 | if (!numSharedFolders && details != VMINFO_MACHINEREADABLE)
|
---|
1461 | RTPrintf("<none>\n");
|
---|
1462 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1463 | RTPrintf("\n");
|
---|
1464 |
|
---|
1465 | if (console)
|
---|
1466 | {
|
---|
1467 | /*
|
---|
1468 | * Live VRDP info.
|
---|
1469 | */
|
---|
1470 | ComPtr<IRemoteDisplayInfo> remoteDisplayInfo;
|
---|
1471 | CHECK_ERROR_RET(console, COMGETTER(RemoteDisplayInfo)(remoteDisplayInfo.asOutParam()), rc);
|
---|
1472 | BOOL Active;
|
---|
1473 | ULONG NumberOfClients;
|
---|
1474 | LONG64 BeginTime;
|
---|
1475 | LONG64 EndTime;
|
---|
1476 | ULONG64 BytesSent;
|
---|
1477 | ULONG64 BytesSentTotal;
|
---|
1478 | ULONG64 BytesReceived;
|
---|
1479 | ULONG64 BytesReceivedTotal;
|
---|
1480 | Bstr User;
|
---|
1481 | Bstr Domain;
|
---|
1482 | Bstr ClientName;
|
---|
1483 | Bstr ClientIP;
|
---|
1484 | ULONG ClientVersion;
|
---|
1485 | ULONG EncryptionStyle;
|
---|
1486 |
|
---|
1487 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(Active) (&Active), rc);
|
---|
1488 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(NumberOfClients) (&NumberOfClients), rc);
|
---|
1489 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BeginTime) (&BeginTime), rc);
|
---|
1490 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(EndTime) (&EndTime), rc);
|
---|
1491 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesSent) (&BytesSent), rc);
|
---|
1492 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesSentTotal) (&BytesSentTotal), rc);
|
---|
1493 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesReceived) (&BytesReceived), rc);
|
---|
1494 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesReceivedTotal) (&BytesReceivedTotal), rc);
|
---|
1495 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(User) (User.asOutParam ()), rc);
|
---|
1496 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(Domain) (Domain.asOutParam ()), rc);
|
---|
1497 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientName) (ClientName.asOutParam ()), rc);
|
---|
1498 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientIP) (ClientIP.asOutParam ()), rc);
|
---|
1499 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientVersion) (&ClientVersion), rc);
|
---|
1500 | CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(EncryptionStyle) (&EncryptionStyle), rc);
|
---|
1501 |
|
---|
1502 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1503 | RTPrintf("VRDPActiveConnection=\"%s\"\n", Active ? "on": "off");
|
---|
1504 | else
|
---|
1505 | RTPrintf("VRDP Connection: %s\n", Active? "active": "not active");
|
---|
1506 |
|
---|
1507 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1508 | RTPrintf("VRDPClients=%d\n", NumberOfClients);
|
---|
1509 | else
|
---|
1510 | RTPrintf("Clients so far: %d\n", NumberOfClients);
|
---|
1511 |
|
---|
1512 | if (NumberOfClients > 0)
|
---|
1513 | {
|
---|
1514 | char timestr[128];
|
---|
1515 |
|
---|
1516 | if (Active)
|
---|
1517 | {
|
---|
1518 | makeTimeStr (timestr, sizeof (timestr), BeginTime);
|
---|
1519 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1520 | RTPrintf("VRDPStartTime=\"%s\"\n", timestr);
|
---|
1521 | else
|
---|
1522 | RTPrintf("Start time: %s\n", timestr);
|
---|
1523 | }
|
---|
1524 | else
|
---|
1525 | {
|
---|
1526 | makeTimeStr (timestr, sizeof (timestr), BeginTime);
|
---|
1527 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1528 | RTPrintf("VRDPLastStartTime=\"%s\"\n", timestr);
|
---|
1529 | else
|
---|
1530 | RTPrintf("Last started: %s\n", timestr);
|
---|
1531 | makeTimeStr (timestr, sizeof (timestr), EndTime);
|
---|
1532 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1533 | RTPrintf("VRDPLastEndTime=\"%s\"\n", timestr);
|
---|
1534 | else
|
---|
1535 | RTPrintf("Last ended: %s\n", timestr);
|
---|
1536 | }
|
---|
1537 |
|
---|
1538 | uint64_t ThroughputSend = 0;
|
---|
1539 | uint64_t ThroughputReceive = 0;
|
---|
1540 | if (EndTime != BeginTime)
|
---|
1541 | {
|
---|
1542 | ThroughputSend = (BytesSent * 1000) / (EndTime - BeginTime);
|
---|
1543 | ThroughputReceive = (BytesReceived * 1000) / (EndTime - BeginTime);
|
---|
1544 | }
|
---|
1545 |
|
---|
1546 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1547 | {
|
---|
1548 | RTPrintf("VRDPBytesSent=%llu\n", BytesSent);
|
---|
1549 | RTPrintf("VRDPThroughputSend=%llu\n", ThroughputSend);
|
---|
1550 | RTPrintf("VRDPBytesSentTotal=%llu\n", BytesSentTotal);
|
---|
1551 |
|
---|
1552 | RTPrintf("VRDPBytesReceived=%llu\n", BytesReceived);
|
---|
1553 | RTPrintf("VRDPThroughputReceive=%llu\n", ThroughputReceive);
|
---|
1554 | RTPrintf("VRDPBytesReceivedTotal=%llu\n", BytesReceivedTotal);
|
---|
1555 | }
|
---|
1556 | else
|
---|
1557 | {
|
---|
1558 | RTPrintf("Sent: %llu Bytes\n", BytesSent);
|
---|
1559 | RTPrintf("Average speed: %llu B/s\n", ThroughputSend);
|
---|
1560 | RTPrintf("Sent total: %llu Bytes\n", BytesSentTotal);
|
---|
1561 |
|
---|
1562 | RTPrintf("Received: %llu Bytes\n", BytesReceived);
|
---|
1563 | RTPrintf("Speed: %llu B/s\n", ThroughputReceive);
|
---|
1564 | RTPrintf("Received total: %llu Bytes\n", BytesReceivedTotal);
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 | if (Active)
|
---|
1568 | {
|
---|
1569 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1570 | {
|
---|
1571 | RTPrintf("VRDPUserName=\"%lS\"\n", User.raw());
|
---|
1572 | RTPrintf("VRDPDomain=\"%lS\"\n", Domain.raw());
|
---|
1573 | RTPrintf("VRDPClientName=\"%lS\"\n", ClientName.raw());
|
---|
1574 | RTPrintf("VRDPClientIP=\"%lS\"\n", ClientIP.raw());
|
---|
1575 | RTPrintf("VRDPClientVersion=%d\n", ClientVersion);
|
---|
1576 | RTPrintf("VRDPEncryption=\"%s\"\n", EncryptionStyle == 0? "RDP4": "RDP5 (X.509)");
|
---|
1577 | }
|
---|
1578 | else
|
---|
1579 | {
|
---|
1580 | RTPrintf("User name: %lS\n", User.raw());
|
---|
1581 | RTPrintf("Domain: %lS\n", Domain.raw());
|
---|
1582 | RTPrintf("Client name: %lS\n", ClientName.raw());
|
---|
1583 | RTPrintf("Client IP: %lS\n", ClientIP.raw());
|
---|
1584 | RTPrintf("Client version: %d\n", ClientVersion);
|
---|
1585 | RTPrintf("Encryption: %s\n", EncryptionStyle == 0? "RDP4": "RDP5 (X.509)");
|
---|
1586 | }
|
---|
1587 | }
|
---|
1588 | }
|
---|
1589 |
|
---|
1590 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1591 | RTPrintf("\n");
|
---|
1592 | }
|
---|
1593 |
|
---|
1594 | if ( details == VMINFO_STANDARD
|
---|
1595 | || details == VMINFO_FULL
|
---|
1596 | || details == VMINFO_MACHINEREADABLE)
|
---|
1597 | {
|
---|
1598 | Bstr description;
|
---|
1599 | machine->COMGETTER(Description)(description.asOutParam());
|
---|
1600 | if (!description.isEmpty())
|
---|
1601 | {
|
---|
1602 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1603 | RTPrintf("description=\"%lS\"\n", description.raw());
|
---|
1604 | else
|
---|
1605 | RTPrintf("Description:\n%lS\n", description.raw());
|
---|
1606 | }
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | ULONG guestVal;
|
---|
1610 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1611 | RTPrintf("Guest:\n\n");
|
---|
1612 |
|
---|
1613 | #ifdef VBOX_WITH_MEM_BALLOONING
|
---|
1614 | rc = machine->COMGETTER(MemoryBalloonSize)(&guestVal);
|
---|
1615 | if (SUCCEEDED(rc))
|
---|
1616 | {
|
---|
1617 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1618 | RTPrintf("GuestMemoryBalloon=%d\n", guestVal);
|
---|
1619 | else
|
---|
1620 | RTPrintf("Configured memory balloon size: %d MB\n", guestVal);
|
---|
1621 | }
|
---|
1622 | #endif
|
---|
1623 | rc = machine->COMGETTER(StatisticsUpdateInterval)(&guestVal);
|
---|
1624 | if (SUCCEEDED(rc))
|
---|
1625 | {
|
---|
1626 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1627 | RTPrintf("GuestStatisticsUpdateInterval=%d\n", guestVal);
|
---|
1628 | else
|
---|
1629 | {
|
---|
1630 | if (guestVal == 0)
|
---|
1631 | RTPrintf("Statistics update: disabled\n");
|
---|
1632 | else
|
---|
1633 | RTPrintf("Statistics update interval: %d seconds\n", guestVal);
|
---|
1634 | }
|
---|
1635 | }
|
---|
1636 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1637 | RTPrintf("\n");
|
---|
1638 |
|
---|
1639 | if ( console
|
---|
1640 | && ( details == VMINFO_STATISTICS
|
---|
1641 | || details == VMINFO_FULL
|
---|
1642 | || details == VMINFO_MACHINEREADABLE))
|
---|
1643 | {
|
---|
1644 | ComPtr <IGuest> guest;
|
---|
1645 |
|
---|
1646 | rc = console->COMGETTER(Guest)(guest.asOutParam());
|
---|
1647 | if (SUCCEEDED(rc))
|
---|
1648 | {
|
---|
1649 | ULONG statVal;
|
---|
1650 |
|
---|
1651 | rc = guest->GetStatistic(0, GuestStatisticType_SampleNumber, &statVal);
|
---|
1652 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1653 | RTPrintf("StatGuestSample=%d\n", statVal);
|
---|
1654 | else
|
---|
1655 | RTPrintf("Guest statistics for sample %d:\n\n", statVal);
|
---|
1656 |
|
---|
1657 | rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_Idle, &statVal);
|
---|
1658 | if (SUCCEEDED(rc))
|
---|
1659 | {
|
---|
1660 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1661 | RTPrintf("StatGuestLoadIdleCPU%d=%d\n", 0, statVal);
|
---|
1662 | else
|
---|
1663 | RTPrintf("CPU%d: CPU Load Idle %-3d%%\n", 0, statVal);
|
---|
1664 | }
|
---|
1665 |
|
---|
1666 | rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_Kernel, &statVal);
|
---|
1667 | if (SUCCEEDED(rc))
|
---|
1668 | {
|
---|
1669 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1670 | RTPrintf("StatGuestLoadKernelCPU%d=%d\n", 0, statVal);
|
---|
1671 | else
|
---|
1672 | RTPrintf("CPU%d: CPU Load Kernel %-3d%%\n", 0, statVal);
|
---|
1673 | }
|
---|
1674 |
|
---|
1675 | rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_User, &statVal);
|
---|
1676 | if (SUCCEEDED(rc))
|
---|
1677 | {
|
---|
1678 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1679 | RTPrintf("StatGuestLoadUserCPU%d=%d\n", 0, statVal);
|
---|
1680 | else
|
---|
1681 | RTPrintf("CPU%d: CPU Load User %-3d%%\n", 0, statVal);
|
---|
1682 | }
|
---|
1683 |
|
---|
1684 | rc = guest->GetStatistic(0, GuestStatisticType_Threads, &statVal);
|
---|
1685 | if (SUCCEEDED(rc))
|
---|
1686 | {
|
---|
1687 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1688 | RTPrintf("StatGuestThreadsCPU%d=%d\n", 0, statVal);
|
---|
1689 | else
|
---|
1690 | RTPrintf("CPU%d: Threads %d\n", 0, statVal);
|
---|
1691 | }
|
---|
1692 |
|
---|
1693 | rc = guest->GetStatistic(0, GuestStatisticType_Processes, &statVal);
|
---|
1694 | if (SUCCEEDED(rc))
|
---|
1695 | {
|
---|
1696 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1697 | RTPrintf("StatGuestProcessesCPU%d=%d\n", 0, statVal);
|
---|
1698 | else
|
---|
1699 | RTPrintf("CPU%d: Processes %d\n", 0, statVal);
|
---|
1700 | }
|
---|
1701 |
|
---|
1702 | rc = guest->GetStatistic(0, GuestStatisticType_Handles, &statVal);
|
---|
1703 | if (SUCCEEDED(rc))
|
---|
1704 | {
|
---|
1705 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1706 | RTPrintf("StatGuestHandlesCPU%d=%d\n", 0, statVal);
|
---|
1707 | else
|
---|
1708 | RTPrintf("CPU%d: Handles %d\n", 0, statVal);
|
---|
1709 | }
|
---|
1710 |
|
---|
1711 | rc = guest->GetStatistic(0, GuestStatisticType_MemoryLoad, &statVal);
|
---|
1712 | if (SUCCEEDED(rc))
|
---|
1713 | {
|
---|
1714 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1715 | RTPrintf("StatGuestMemoryLoadCPU%d=%d\n", 0, statVal);
|
---|
1716 | else
|
---|
1717 | RTPrintf("CPU%d: Memory Load %d%%\n", 0, statVal);
|
---|
1718 | }
|
---|
1719 |
|
---|
1720 | rc = guest->GetStatistic(0, GuestStatisticType_PhysMemTotal, &statVal);
|
---|
1721 | if (SUCCEEDED(rc))
|
---|
1722 | {
|
---|
1723 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1724 | RTPrintf("StatGuestMemoryTotalPhysCPU%d=%d\n", 0, statVal);
|
---|
1725 | else
|
---|
1726 | RTPrintf("CPU%d: Total physical memory %-4d MB\n", 0, statVal);
|
---|
1727 | }
|
---|
1728 |
|
---|
1729 | rc = guest->GetStatistic(0, GuestStatisticType_PhysMemAvailable, &statVal);
|
---|
1730 | if (SUCCEEDED(rc))
|
---|
1731 | {
|
---|
1732 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1733 | RTPrintf("StatGuestMemoryFreePhysCPU%d=%d\n", 0, statVal);
|
---|
1734 | else
|
---|
1735 | RTPrintf("CPU%d: Free physical memory %-4d MB\n", 0, statVal);
|
---|
1736 | }
|
---|
1737 |
|
---|
1738 | #ifdef VBOX_WITH_MEM_BALLOONING
|
---|
1739 | rc = guest->GetStatistic(0, GuestStatisticType_PhysMemBalloon, &statVal);
|
---|
1740 | if (SUCCEEDED(rc))
|
---|
1741 | {
|
---|
1742 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1743 | RTPrintf("StatGuestMemoryBalloonCPU%d=%d\n", 0, statVal);
|
---|
1744 | else
|
---|
1745 | RTPrintf("CPU%d: Memory balloon size %-4d MB\n", 0, statVal);
|
---|
1746 | }
|
---|
1747 | #endif
|
---|
1748 | rc = guest->GetStatistic(0, GuestStatisticType_MemCommitTotal, &statVal);
|
---|
1749 | if (SUCCEEDED(rc))
|
---|
1750 | {
|
---|
1751 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1752 | RTPrintf("StatGuestMemoryCommittedCPU%d=%d\n", 0, statVal);
|
---|
1753 | else
|
---|
1754 | RTPrintf("CPU%d: Committed memory %-4d MB\n", 0, statVal);
|
---|
1755 | }
|
---|
1756 |
|
---|
1757 | rc = guest->GetStatistic(0, GuestStatisticType_MemKernelTotal, &statVal);
|
---|
1758 | if (SUCCEEDED(rc))
|
---|
1759 | {
|
---|
1760 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1761 | RTPrintf("StatGuestMemoryTotalKernelCPU%d=%d\n", 0, statVal);
|
---|
1762 | else
|
---|
1763 | RTPrintf("CPU%d: Total kernel memory %-4d MB\n", 0, statVal);
|
---|
1764 | }
|
---|
1765 |
|
---|
1766 | rc = guest->GetStatistic(0, GuestStatisticType_MemKernelPaged, &statVal);
|
---|
1767 | if (SUCCEEDED(rc))
|
---|
1768 | {
|
---|
1769 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1770 | RTPrintf("StatGuestMemoryPagedKernelCPU%d=%d\n", 0, statVal);
|
---|
1771 | else
|
---|
1772 | RTPrintf("CPU%d: Paged kernel memory %-4d MB\n", 0, statVal);
|
---|
1773 | }
|
---|
1774 |
|
---|
1775 | rc = guest->GetStatistic(0, GuestStatisticType_MemKernelNonpaged, &statVal);
|
---|
1776 | if (SUCCEEDED(rc))
|
---|
1777 | {
|
---|
1778 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1779 | RTPrintf("StatGuestMemoryNonpagedKernelCPU%d=%d\n", 0, statVal);
|
---|
1780 | else
|
---|
1781 | RTPrintf("CPU%d: Nonpaged kernel memory %-4d MB\n", 0, statVal);
|
---|
1782 | }
|
---|
1783 |
|
---|
1784 | rc = guest->GetStatistic(0, GuestStatisticType_MemSystemCache, &statVal);
|
---|
1785 | if (SUCCEEDED(rc))
|
---|
1786 | {
|
---|
1787 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1788 | RTPrintf("StatGuestSystemCacheSizeCPU%d=%d\n", 0, statVal);
|
---|
1789 | else
|
---|
1790 | RTPrintf("CPU%d: System cache size %-4d MB\n", 0, statVal);
|
---|
1791 | }
|
---|
1792 |
|
---|
1793 | rc = guest->GetStatistic(0, GuestStatisticType_PageFileSize, &statVal);
|
---|
1794 | if (SUCCEEDED(rc))
|
---|
1795 | {
|
---|
1796 | if (details == VMINFO_MACHINEREADABLE)
|
---|
1797 | RTPrintf("StatGuestPageFileSizeCPU%d=%d\n", 0, statVal);
|
---|
1798 | else
|
---|
1799 | RTPrintf("CPU%d: Page file size %-4d MB\n", 0, statVal);
|
---|
1800 | }
|
---|
1801 |
|
---|
1802 | RTPrintf("\n");
|
---|
1803 | }
|
---|
1804 | else
|
---|
1805 | {
|
---|
1806 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1807 | {
|
---|
1808 | RTPrintf("[!] FAILED calling console->getGuest at line %d!\n", __LINE__);
|
---|
1809 | GluePrintRCMessage(rc);
|
---|
1810 | }
|
---|
1811 | }
|
---|
1812 | }
|
---|
1813 |
|
---|
1814 | /*
|
---|
1815 | * snapshots
|
---|
1816 | */
|
---|
1817 | ComPtr<ISnapshot> snapshot;
|
---|
1818 | rc = machine->GetSnapshot(Guid(), snapshot.asOutParam());
|
---|
1819 | if (SUCCEEDED(rc) && snapshot)
|
---|
1820 | {
|
---|
1821 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1822 | RTPrintf("Snapshots:\n\n");
|
---|
1823 | showSnapshots(snapshot, details);
|
---|
1824 | }
|
---|
1825 |
|
---|
1826 | if (details != VMINFO_MACHINEREADABLE)
|
---|
1827 | RTPrintf("\n");
|
---|
1828 | return S_OK;
|
---|
1829 | }
|
---|
1830 |
|
---|
1831 | #if defined(_MSC_VER)
|
---|
1832 | # pragma optimize("", on)
|
---|
1833 | #endif
|
---|
1834 |
|
---|
1835 | int handleShowVMInfo(HandlerArg *a)
|
---|
1836 | {
|
---|
1837 | HRESULT rc;
|
---|
1838 |
|
---|
1839 | /* at least one option: the UUID or name of the VM */
|
---|
1840 | if (a->argc < 1)
|
---|
1841 | return errorSyntax(USAGE_SHOWVMINFO, "Incorrect number of parameters");
|
---|
1842 |
|
---|
1843 | /* try to find the given machine */
|
---|
1844 | ComPtr <IMachine> machine;
|
---|
1845 | Guid uuid (a->argv[0]);
|
---|
1846 | if (!uuid.isEmpty())
|
---|
1847 | {
|
---|
1848 | CHECK_ERROR (a->virtualBox, GetMachine (uuid, machine.asOutParam()));
|
---|
1849 | }
|
---|
1850 | else
|
---|
1851 | {
|
---|
1852 | CHECK_ERROR (a->virtualBox, FindMachine (Bstr(a->argv[0]), machine.asOutParam()));
|
---|
1853 | if (SUCCEEDED (rc))
|
---|
1854 | machine->COMGETTER(Id) (uuid.asOutParam());
|
---|
1855 | }
|
---|
1856 | if (FAILED (rc))
|
---|
1857 | return 1;
|
---|
1858 |
|
---|
1859 | /* 2nd option can be -details, -statistics or -argdump */
|
---|
1860 | VMINFO_DETAILS details = VMINFO_NONE;
|
---|
1861 | bool fDetails = false;
|
---|
1862 | bool fStatistics = false;
|
---|
1863 | bool fMachinereadable = false;
|
---|
1864 | for (int i=1;i<a->argc;i++)
|
---|
1865 | {
|
---|
1866 | if (!strcmp(a->argv[i], "-details"))
|
---|
1867 | fDetails = true;
|
---|
1868 | else
|
---|
1869 | if (!strcmp(a->argv[i], "-statistics"))
|
---|
1870 | fStatistics = true;
|
---|
1871 | if (!strcmp(a->argv[1], "-machinereadable"))
|
---|
1872 | fMachinereadable = true;
|
---|
1873 | }
|
---|
1874 | if (fMachinereadable)
|
---|
1875 | details = VMINFO_MACHINEREADABLE;
|
---|
1876 | else
|
---|
1877 | if (fDetails && fStatistics)
|
---|
1878 | details = VMINFO_FULL;
|
---|
1879 | else
|
---|
1880 | if (fDetails)
|
---|
1881 | details = VMINFO_STANDARD;
|
---|
1882 | else
|
---|
1883 | if (fStatistics)
|
---|
1884 | details = VMINFO_STATISTICS;
|
---|
1885 |
|
---|
1886 | ComPtr <IConsole> console;
|
---|
1887 |
|
---|
1888 | /* open an existing session for the VM */
|
---|
1889 | rc = a->virtualBox->OpenExistingSession (a->session, uuid);
|
---|
1890 | if (SUCCEEDED(rc))
|
---|
1891 | /* get the session machine */
|
---|
1892 | rc = a->session->COMGETTER(Machine)(machine.asOutParam());
|
---|
1893 | if (SUCCEEDED(rc))
|
---|
1894 | /* get the session console */
|
---|
1895 | rc = a->session->COMGETTER(Console)(console.asOutParam());
|
---|
1896 |
|
---|
1897 | rc = showVMInfo(a->virtualBox, machine, details, console);
|
---|
1898 |
|
---|
1899 | if (console)
|
---|
1900 | a->session->Close();
|
---|
1901 |
|
---|
1902 | return SUCCEEDED (rc) ? 0 : 1;
|
---|
1903 | }
|
---|
1904 |
|
---|
1905 | #endif /* !VBOX_ONLY_DOCS */
|
---|
1906 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|