[12599] | 1 | /* $Id: VBoxManageInfo.cpp 77910 2019-03-27 11:33:01Z vboxsync $ */
|
---|
[1] | 2 | /** @file
|
---|
[14732] | 3 | * VBoxManage - The 'showvminfo' command and helper routines.
|
---|
[1] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[76553] | 7 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
[1] | 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
|
---|
[5999] | 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.
|
---|
[1] | 16 | */
|
---|
| 17 |
|
---|
[14555] | 18 | #ifndef VBOX_ONLY_DOCS
|
---|
[1] | 19 |
|
---|
[57358] | 20 |
|
---|
| 21 | /*********************************************************************************************************************************
|
---|
| 22 | * Header Files *
|
---|
| 23 | *********************************************************************************************************************************/
|
---|
[1] | 24 | #include <VBox/com/com.h>
|
---|
| 25 | #include <VBox/com/string.h>
|
---|
| 26 | #include <VBox/com/Guid.h>
|
---|
[7379] | 27 | #include <VBox/com/array.h>
|
---|
[1] | 28 | #include <VBox/com/ErrorInfo.h>
|
---|
[20928] | 29 | #include <VBox/com/errorprint.h>
|
---|
[1] | 30 |
|
---|
| 31 | #include <VBox/com/VirtualBox.h>
|
---|
| 32 |
|
---|
[36630] | 33 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
| 34 | #include <VBox/pci.h>
|
---|
| 35 | #endif
|
---|
| 36 |
|
---|
[14814] | 37 | #include <VBox/log.h>
|
---|
[60410] | 38 | #include <VBox/version.h>
|
---|
[1] | 39 | #include <iprt/stream.h>
|
---|
[14814] | 40 | #include <iprt/time.h>
|
---|
[1] | 41 | #include <iprt/string.h>
|
---|
[18773] | 42 | #include <iprt/getopt.h>
|
---|
| 43 | #include <iprt/ctype.h>
|
---|
[1] | 44 |
|
---|
| 45 | #include "VBoxManage.h"
|
---|
| 46 | using namespace com;
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | // funcs
|
---|
| 50 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 51 |
|
---|
[75380] | 52 | /**
|
---|
| 53 | * Helper for formatting an indexed name or some such thing.
|
---|
| 54 | */
|
---|
| 55 | static const char *FmtNm(char psz[80], const char *pszFormat, ...)
|
---|
| 56 | {
|
---|
| 57 | va_list va;
|
---|
| 58 | va_start(va, pszFormat);
|
---|
| 59 | RTStrPrintfV(psz, 80, pszFormat, va);
|
---|
| 60 | va_end(va);
|
---|
| 61 | return psz;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
[39119] | 64 | HRESULT showSnapshots(ComPtr<ISnapshot> &rootSnapshot,
|
---|
| 65 | ComPtr<ISnapshot> ¤tSnapshot,
|
---|
| 66 | VMINFO_DETAILS details,
|
---|
[44028] | 67 | const Utf8Str &prefix /* = ""*/,
|
---|
[39119] | 68 | int level /*= 0*/)
|
---|
[1] | 69 | {
|
---|
| 70 | /* start with the root */
|
---|
| 71 | Bstr name;
|
---|
[19239] | 72 | Bstr uuid;
|
---|
[44028] | 73 | Bstr description;
|
---|
[56118] | 74 | CHECK_ERROR2I_RET(rootSnapshot, COMGETTER(Name)(name.asOutParam()), hrcCheck);
|
---|
| 75 | CHECK_ERROR2I_RET(rootSnapshot, COMGETTER(Id)(uuid.asOutParam()), hrcCheck);
|
---|
| 76 | CHECK_ERROR2I_RET(rootSnapshot, COMGETTER(Description)(description.asOutParam()), hrcCheck);
|
---|
[44028] | 77 | bool fCurrent = (rootSnapshot == currentSnapshot);
|
---|
[4779] | 78 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 79 | {
|
---|
| 80 | /* print with hierarchical numbering */
|
---|
[44028] | 81 | RTPrintf("SnapshotName%s=\"%ls\"\n", prefix.c_str(), name.raw());
|
---|
| 82 | RTPrintf("SnapshotUUID%s=\"%s\"\n", prefix.c_str(), Utf8Str(uuid).c_str());
|
---|
| 83 | if (!description.isEmpty())
|
---|
| 84 | RTPrintf("SnapshotDescription%s=\"%ls\"\n", prefix.c_str(), description.raw());
|
---|
| 85 | if (fCurrent)
|
---|
| 86 | {
|
---|
| 87 | RTPrintf("CurrentSnapshotName=\"%ls\"\n", name.raw());
|
---|
| 88 | RTPrintf("CurrentSnapshotUUID=\"%s\"\n", Utf8Str(uuid).c_str());
|
---|
| 89 | RTPrintf("CurrentSnapshotNode=\"SnapshotName%s\"\n", prefix.c_str());
|
---|
| 90 | }
|
---|
[4779] | 91 | }
|
---|
| 92 | else
|
---|
| 93 | {
|
---|
| 94 | /* print with indentation */
|
---|
[44028] | 95 | RTPrintf(" %sName: %ls (UUID: %s)%s\n",
|
---|
| 96 | prefix.c_str(),
|
---|
[23882] | 97 | name.raw(),
|
---|
[31539] | 98 | Utf8Str(uuid).c_str(),
|
---|
[23882] | 99 | (fCurrent) ? " *" : "");
|
---|
[44028] | 100 | if (!description.isEmpty())
|
---|
| 101 | RTPrintf(" %sDescription:\n%ls\n", prefix.c_str(), description.raw());
|
---|
[4779] | 102 | }
|
---|
[1] | 103 |
|
---|
| 104 | /* get the children */
|
---|
[39119] | 105 | HRESULT hrc = S_OK;
|
---|
[17260] | 106 | SafeIfaceArray <ISnapshot> coll;
|
---|
[56118] | 107 | CHECK_ERROR2I_RET(rootSnapshot,COMGETTER(Children)(ComSafeArrayAsOutParam(coll)), hrcCheck);
|
---|
[17260] | 108 | if (!coll.isNull())
|
---|
[1] | 109 | {
|
---|
[17260] | 110 | for (size_t index = 0; index < coll.size(); ++index)
|
---|
[1] | 111 | {
|
---|
[17260] | 112 | ComPtr<ISnapshot> snapshot = coll[index];
|
---|
[1] | 113 | if (snapshot)
|
---|
| 114 | {
|
---|
[44028] | 115 | Utf8Str newPrefix;
|
---|
[4779] | 116 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[44028] | 117 | newPrefix = Utf8StrFmt("%s-%d", prefix.c_str(), index + 1);
|
---|
[4779] | 118 | else
|
---|
[23882] | 119 | {
|
---|
[44028] | 120 | newPrefix = Utf8StrFmt("%s ", prefix.c_str());
|
---|
[23882] | 121 | }
|
---|
| 122 |
|
---|
[1] | 123 | /* recursive call */
|
---|
[39119] | 124 | HRESULT hrc2 = showSnapshots(snapshot, currentSnapshot, details, newPrefix, level + 1);
|
---|
| 125 | if (FAILED(hrc2))
|
---|
| 126 | hrc = hrc2;
|
---|
[1] | 127 | }
|
---|
| 128 | }
|
---|
| 129 | }
|
---|
[39119] | 130 | return hrc;
|
---|
[1] | 131 | }
|
---|
| 132 |
|
---|
[32718] | 133 | static void makeTimeStr(char *s, int cb, int64_t millies)
|
---|
[1] | 134 | {
|
---|
| 135 | RTTIME t;
|
---|
| 136 | RTTIMESPEC ts;
|
---|
| 137 |
|
---|
| 138 | RTTimeSpecSetMilli(&ts, millies);
|
---|
| 139 |
|
---|
[32718] | 140 | RTTimeExplode(&t, &ts);
|
---|
[1] | 141 |
|
---|
| 142 | RTStrPrintf(s, cb, "%04d/%02d/%02d %02d:%02d:%02d UTC",
|
---|
| 143 | t.i32Year, t.u8Month, t.u8MonthDay,
|
---|
| 144 | t.u8Hour, t.u8Minute, t.u8Second);
|
---|
| 145 | }
|
---|
| 146 |
|
---|
[35907] | 147 | const char *machineStateToName(MachineState_T machineState, bool fShort)
|
---|
[35707] | 148 | {
|
---|
| 149 | switch (machineState)
|
---|
| 150 | {
|
---|
| 151 | case MachineState_PoweredOff:
|
---|
| 152 | return fShort ? "poweroff" : "powered off";
|
---|
| 153 | case MachineState_Saved:
|
---|
| 154 | return "saved";
|
---|
[55214] | 155 | case MachineState_Teleported:
|
---|
| 156 | return "teleported";
|
---|
[35707] | 157 | case MachineState_Aborted:
|
---|
| 158 | return "aborted";
|
---|
| 159 | case MachineState_Running:
|
---|
| 160 | return "running";
|
---|
| 161 | case MachineState_Paused:
|
---|
| 162 | return "paused";
|
---|
| 163 | case MachineState_Stuck:
|
---|
| 164 | return fShort ? "gurumeditation" : "guru meditation";
|
---|
[55214] | 165 | case MachineState_Teleporting:
|
---|
| 166 | return "teleporting";
|
---|
[35707] | 167 | case MachineState_LiveSnapshotting:
|
---|
| 168 | return fShort ? "livesnapshotting" : "live snapshotting";
|
---|
| 169 | case MachineState_Starting:
|
---|
| 170 | return "starting";
|
---|
| 171 | case MachineState_Stopping:
|
---|
| 172 | return "stopping";
|
---|
| 173 | case MachineState_Saving:
|
---|
| 174 | return "saving";
|
---|
| 175 | case MachineState_Restoring:
|
---|
| 176 | return "restoring";
|
---|
| 177 | case MachineState_TeleportingPausedVM:
|
---|
| 178 | return fShort ? "teleportingpausedvm" : "teleporting paused vm";
|
---|
| 179 | case MachineState_TeleportingIn:
|
---|
| 180 | return fShort ? "teleportingin" : "teleporting (incoming)";
|
---|
[55214] | 181 | case MachineState_FaultTolerantSyncing:
|
---|
| 182 | return fShort ? "faulttolerantsyncing" : "fault tolerant syncing";
|
---|
| 183 | case MachineState_DeletingSnapshotOnline:
|
---|
| 184 | return fShort ? "deletingsnapshotlive" : "deleting snapshot live";
|
---|
| 185 | case MachineState_DeletingSnapshotPaused:
|
---|
| 186 | return fShort ? "deletingsnapshotlivepaused" : "deleting snapshot live paused";
|
---|
| 187 | case MachineState_OnlineSnapshotting:
|
---|
| 188 | return fShort ? "onlinesnapshotting" : "online snapshotting";
|
---|
[35707] | 189 | case MachineState_RestoringSnapshot:
|
---|
| 190 | return fShort ? "restoringsnapshot" : "restoring snapshot";
|
---|
| 191 | case MachineState_DeletingSnapshot:
|
---|
| 192 | return fShort ? "deletingsnapshot" : "deleting snapshot";
|
---|
| 193 | case MachineState_SettingUp:
|
---|
[55214] | 194 | return fShort ? "settingup" : "setting up";
|
---|
| 195 | case MachineState_Snapshotting:
|
---|
| 196 | return fShort ? "snapshotting" : "offline snapshotting";
|
---|
[35707] | 197 | default:
|
---|
[35907] | 198 | break;
|
---|
[35707] | 199 | }
|
---|
[35907] | 200 | return "unknown";
|
---|
[35707] | 201 | }
|
---|
| 202 |
|
---|
[35907] | 203 | const char *facilityStateToName(AdditionsFacilityStatus_T faStatus, bool fShort)
|
---|
| 204 | {
|
---|
| 205 | switch (faStatus)
|
---|
| 206 | {
|
---|
| 207 | case AdditionsFacilityStatus_Inactive:
|
---|
| 208 | return fShort ? "inactive" : "not active";
|
---|
| 209 | case AdditionsFacilityStatus_Paused:
|
---|
| 210 | return "paused";
|
---|
| 211 | case AdditionsFacilityStatus_PreInit:
|
---|
| 212 | return fShort ? "preinit" : "pre-initializing";
|
---|
| 213 | case AdditionsFacilityStatus_Init:
|
---|
| 214 | return fShort ? "init" : "initializing";
|
---|
| 215 | case AdditionsFacilityStatus_Active:
|
---|
| 216 | return fShort ? "active" : "active/running";
|
---|
| 217 | case AdditionsFacilityStatus_Terminating:
|
---|
| 218 | return "terminating";
|
---|
| 219 | case AdditionsFacilityStatus_Terminated:
|
---|
| 220 | return "terminated";
|
---|
| 221 | case AdditionsFacilityStatus_Failed:
|
---|
| 222 | return "failed";
|
---|
| 223 | case AdditionsFacilityStatus_Unknown:
|
---|
| 224 | default:
|
---|
| 225 | break;
|
---|
| 226 | }
|
---|
| 227 | return "unknown";
|
---|
| 228 | }
|
---|
| 229 |
|
---|
[40418] | 230 | /**
|
---|
| 231 | * This takes care of escaping double quotes and slashes that the string might
|
---|
| 232 | * contain.
|
---|
| 233 | *
|
---|
| 234 | * @param pszName The variable name.
|
---|
[70717] | 235 | * @param pszValue The value.
|
---|
[40418] | 236 | */
|
---|
[70717] | 237 | static void outputMachineReadableString(const char *pszName, const char *pszValue)
|
---|
[40418] | 238 | {
|
---|
| 239 | Assert(strpbrk(pszName, "\"\\") == NULL);
|
---|
| 240 |
|
---|
[70717] | 241 | if ( !pszValue
|
---|
| 242 | || !*pszValue
|
---|
| 243 | || ( strchr(pszValue, '"') == NULL
|
---|
| 244 | && strchr(pszValue, '\\') == NULL) )
|
---|
| 245 | RTPrintf("%s=\"%s\"\n", pszName, pszValue);
|
---|
[40418] | 246 | else
|
---|
| 247 | {
|
---|
| 248 | /* The value needs escaping. */
|
---|
| 249 | RTPrintf("%s=\"", pszName);
|
---|
[70717] | 250 | const char *psz = pszValue;
|
---|
[40418] | 251 | for (;;)
|
---|
| 252 | {
|
---|
| 253 | const char *pszNext = strpbrk(psz, "\"\\");
|
---|
| 254 | if (!pszNext)
|
---|
| 255 | {
|
---|
| 256 | RTPrintf("%s", psz);
|
---|
| 257 | break;
|
---|
| 258 | }
|
---|
[43421] | 259 | RTPrintf("%.*s\\%c", pszNext - psz, psz, *pszNext);
|
---|
[40418] | 260 | psz = pszNext + 1;
|
---|
| 261 | }
|
---|
| 262 | RTPrintf("\"\n");
|
---|
| 263 | }
|
---|
| 264 | }
|
---|
| 265 |
|
---|
[70717] | 266 |
|
---|
[40470] | 267 | /**
|
---|
[70717] | 268 | * This takes care of escaping double quotes and slashes that the string might
|
---|
| 269 | * contain.
|
---|
| 270 | *
|
---|
| 271 | * @param pszName The variable name.
|
---|
| 272 | * @param pbstrValue The value.
|
---|
| 273 | */
|
---|
| 274 | static void outputMachineReadableString(const char *pszName, Bstr const *pbstrValue)
|
---|
| 275 | {
|
---|
| 276 | com::Utf8Str strValue(*pbstrValue);
|
---|
| 277 | outputMachineReadableString(pszName, strValue.c_str());
|
---|
| 278 | }
|
---|
| 279 |
|
---|
| 280 | /**
|
---|
[40470] | 281 | * Converts bandwidth group type to a string.
|
---|
| 282 | * @returns String representation.
|
---|
| 283 | * @param enmType Bandwidth control group type.
|
---|
| 284 | */
|
---|
[72976] | 285 | static const char * bwGroupTypeToString(BandwidthGroupType_T enmType)
|
---|
[40470] | 286 | {
|
---|
| 287 | switch (enmType)
|
---|
| 288 | {
|
---|
[63300] | 289 | case BandwidthGroupType_Null: return "Null";
|
---|
[40470] | 290 | case BandwidthGroupType_Disk: return "Disk";
|
---|
| 291 | case BandwidthGroupType_Network: return "Network";
|
---|
[72976] | 292 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
| 293 | case BandwidthGroupType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
| 294 | #endif
|
---|
[40470] | 295 | }
|
---|
| 296 | return "unknown";
|
---|
| 297 | }
|
---|
[40418] | 298 |
|
---|
[40470] | 299 | HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl,
|
---|
| 300 | VMINFO_DETAILS details)
|
---|
| 301 | {
|
---|
| 302 | int rc = S_OK;
|
---|
| 303 | SafeIfaceArray<IBandwidthGroup> bwGroups;
|
---|
| 304 |
|
---|
| 305 | CHECK_ERROR_RET(bwCtrl, GetAllBandwidthGroups(ComSafeArrayAsOutParam(bwGroups)), rc);
|
---|
| 306 |
|
---|
[41584] | 307 | if (bwGroups.size() && details != VMINFO_MACHINEREADABLE)
|
---|
| 308 | RTPrintf("\n\n");
|
---|
[40470] | 309 | for (size_t i = 0; i < bwGroups.size(); i++)
|
---|
| 310 | {
|
---|
| 311 | Bstr strName;
|
---|
[41842] | 312 | LONG64 cMaxBytesPerSec;
|
---|
[40470] | 313 | BandwidthGroupType_T enmType;
|
---|
| 314 |
|
---|
| 315 | CHECK_ERROR_RET(bwGroups[i], COMGETTER(Name)(strName.asOutParam()), rc);
|
---|
| 316 | CHECK_ERROR_RET(bwGroups[i], COMGETTER(Type)(&enmType), rc);
|
---|
[41842] | 317 | CHECK_ERROR_RET(bwGroups[i], COMGETTER(MaxBytesPerSec)(&cMaxBytesPerSec), rc);
|
---|
[40470] | 318 |
|
---|
| 319 | const char *pszType = bwGroupTypeToString(enmType);
|
---|
| 320 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[41842] | 321 | RTPrintf("BandwidthGroup%zu=%ls,%s,%lld\n", i, strName.raw(), pszType, cMaxBytesPerSec);
|
---|
[40470] | 322 | else
|
---|
[41842] | 323 | {
|
---|
| 324 | const char *pszUnits = "";
|
---|
| 325 | LONG64 cBytes = cMaxBytesPerSec;
|
---|
[41890] | 326 | if (cBytes == 0)
|
---|
[41842] | 327 | {
|
---|
[41890] | 328 | RTPrintf("Name: '%ls', Type: %s, Limit: none (disabled)\n", strName.raw(), pszType);
|
---|
| 329 | continue;
|
---|
| 330 | }
|
---|
| 331 | else if (!(cBytes % _1G))
|
---|
| 332 | {
|
---|
[41842] | 333 | pszUnits = "G";
|
---|
| 334 | cBytes /= _1G;
|
---|
| 335 | }
|
---|
| 336 | else if (!(cBytes % _1M))
|
---|
| 337 | {
|
---|
| 338 | pszUnits = "M";
|
---|
| 339 | cBytes /= _1M;
|
---|
| 340 | }
|
---|
| 341 | else if (!(cBytes % _1K))
|
---|
| 342 | {
|
---|
| 343 | pszUnits = "K";
|
---|
| 344 | cBytes /= _1K;
|
---|
| 345 | }
|
---|
| 346 | const char *pszNetUnits = NULL;
|
---|
| 347 | if (enmType == BandwidthGroupType_Network)
|
---|
| 348 | {
|
---|
| 349 | /*
|
---|
| 350 | * We want to report network rate limit in bits/s, not bytes.
|
---|
| 351 | * Only if it cannot be express it in kilobits we will fall
|
---|
| 352 | * back to reporting it in bytes.
|
---|
| 353 | */
|
---|
| 354 | LONG64 cBits = cMaxBytesPerSec;
|
---|
| 355 | if (!(cBits % 125))
|
---|
| 356 | {
|
---|
| 357 | cBits /= 125;
|
---|
| 358 | pszNetUnits = "k";
|
---|
| 359 | if (!(cBits % 1000000))
|
---|
| 360 | {
|
---|
| 361 | cBits /= 1000000;
|
---|
| 362 | pszNetUnits = "g";
|
---|
| 363 | }
|
---|
| 364 | else if (!(cBits % 1000))
|
---|
| 365 | {
|
---|
| 366 | cBits /= 1000;
|
---|
| 367 | pszNetUnits = "m";
|
---|
| 368 | }
|
---|
| 369 | RTPrintf("Name: '%ls', Type: %s, Limit: %lld %sbits/sec (%lld %sbytes/sec)\n", strName.raw(), pszType, cBits, pszNetUnits, cBytes, pszUnits);
|
---|
| 370 | }
|
---|
| 371 | }
|
---|
| 372 | if (!pszNetUnits)
|
---|
| 373 | RTPrintf("Name: '%ls', Type: %s, Limit: %lld %sbytes/sec\n", strName.raw(), pszType, cBytes, pszUnits);
|
---|
| 374 | }
|
---|
[40470] | 375 | }
|
---|
[41584] | 376 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 377 | RTPrintf(bwGroups.size() != 0 ? "\n" : "<none>\n\n");
|
---|
[40470] | 378 |
|
---|
| 379 | return rc;
|
---|
| 380 | }
|
---|
| 381 |
|
---|
[75380] | 382 | /** Shows a shared folder. */
|
---|
| 383 | static HRESULT showSharedFolder(ComPtr<ISharedFolder> &sf, VMINFO_DETAILS details, const char *pszDesc,
|
---|
| 384 | const char *pszMrInfix, size_t idxMr, bool fFirst)
|
---|
| 385 | {
|
---|
| 386 | Bstr name, hostPath, bstrAutoMountPoint;
|
---|
| 387 | BOOL writable = FALSE, fAutoMount = FALSE;
|
---|
| 388 | CHECK_ERROR2I_RET(sf, COMGETTER(Name)(name.asOutParam()), hrcCheck);
|
---|
| 389 | CHECK_ERROR2I_RET(sf, COMGETTER(HostPath)(hostPath.asOutParam()), hrcCheck);
|
---|
| 390 | CHECK_ERROR2I_RET(sf, COMGETTER(Writable)(&writable), hrcCheck);
|
---|
| 391 | CHECK_ERROR2I_RET(sf, COMGETTER(AutoMount)(&fAutoMount), hrcCheck);
|
---|
| 392 | CHECK_ERROR2I_RET(sf, COMGETTER(AutoMountPoint)(bstrAutoMountPoint.asOutParam()), hrcCheck);
|
---|
| 393 |
|
---|
| 394 | if (fFirst && details != VMINFO_MACHINEREADABLE)
|
---|
| 395 | RTPrintf("\n\n");
|
---|
| 396 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 397 | {
|
---|
| 398 | char szNm[80];
|
---|
| 399 | outputMachineReadableString(FmtNm(szNm, "SharedFolderName%s%zu", pszMrInfix, idxMr), &name);
|
---|
| 400 | outputMachineReadableString(FmtNm(szNm, "SharedFolderPath%s%zu", pszMrInfix, idxMr), &hostPath);
|
---|
| 401 | }
|
---|
| 402 | else
|
---|
| 403 | {
|
---|
[75382] | 404 | RTPrintf("Name: '%ls', Host path: '%ls' (%s), %s%s",
|
---|
[75380] | 405 | name.raw(), hostPath.raw(), pszDesc, writable ? "writable" : "readonly", fAutoMount ? ", auto-mount" : "");
|
---|
| 406 | if (bstrAutoMountPoint.isNotEmpty())
|
---|
| 407 | RTPrintf(", mount-point: '%ls'\n", bstrAutoMountPoint.raw());
|
---|
| 408 | else
|
---|
| 409 | RTPrintf("\n");
|
---|
| 410 | }
|
---|
| 411 | return S_OK;
|
---|
| 412 | }
|
---|
| 413 |
|
---|
| 414 |
|
---|
[58450] | 415 | static const char *paravirtProviderToString(ParavirtProvider_T provider, VMINFO_DETAILS details)
|
---|
| 416 | {
|
---|
| 417 | switch (provider)
|
---|
| 418 | {
|
---|
| 419 | case ParavirtProvider_None:
|
---|
| 420 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 421 | return "none";
|
---|
| 422 | return "None";
|
---|
[40470] | 423 |
|
---|
[58450] | 424 | case ParavirtProvider_Default:
|
---|
| 425 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 426 | return "default";
|
---|
| 427 | return "Default";
|
---|
| 428 |
|
---|
| 429 | case ParavirtProvider_Legacy:
|
---|
| 430 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 431 | return "legacy";
|
---|
| 432 | return "Legacy";
|
---|
| 433 |
|
---|
| 434 | case ParavirtProvider_Minimal:
|
---|
| 435 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 436 | return "minimal";
|
---|
| 437 | return "Minimal";
|
---|
| 438 |
|
---|
| 439 | case ParavirtProvider_HyperV:
|
---|
| 440 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 441 | return "hyperv";
|
---|
| 442 | return "HyperV";
|
---|
| 443 |
|
---|
| 444 | case ParavirtProvider_KVM:
|
---|
| 445 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 446 | return "kvm";
|
---|
| 447 | return "KVM";
|
---|
| 448 |
|
---|
| 449 | default:
|
---|
| 450 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 451 | return "unknown";
|
---|
| 452 | return "Unknown";
|
---|
| 453 | }
|
---|
| 454 | }
|
---|
| 455 |
|
---|
| 456 |
|
---|
[14611] | 457 | /* Disable global optimizations for MSC 8.0/64 to make it compile in reasonable
|
---|
[14613] | 458 | time. MSC 7.1/32 doesn't have quite as much trouble with it, but still
|
---|
| 459 | sufficient to qualify for this hack as well since this code isn't performance
|
---|
| 460 | critical and probably won't gain much from the extra optimizing in real life. */
|
---|
| 461 | #if defined(_MSC_VER)
|
---|
[14611] | 462 | # pragma optimize("g", off)
|
---|
[63300] | 463 | # pragma warning(push)
|
---|
[66830] | 464 | # if _MSC_VER < RT_MSC_VER_VC120
|
---|
| 465 | # pragma warning(disable: 4748)
|
---|
| 466 | # endif
|
---|
[14611] | 467 | #endif
|
---|
| 468 |
|
---|
[53266] | 469 | HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox,
|
---|
[32718] | 470 | ComPtr<IMachine> machine,
|
---|
[53266] | 471 | ComPtr<ISession> pSession,
|
---|
| 472 | VMINFO_DETAILS details /*= VMINFO_NONE*/)
|
---|
[1] | 473 | {
|
---|
| 474 | HRESULT rc;
|
---|
[53266] | 475 | ComPtr<IConsole> pConsole;
|
---|
| 476 | if (pSession)
|
---|
| 477 | pSession->COMGETTER(Console)(pConsole.asOutParam());
|
---|
[1] | 478 |
|
---|
[70717] | 479 | char szNm[80];
|
---|
| 480 | char szValue[256];
|
---|
[40419] | 481 |
|
---|
[70717] | 482 | #define SHOW_UTF8_STRING(a_pszMachine, a_pszHuman, a_szValue) \
|
---|
[40418] | 483 | do \
|
---|
| 484 | { \
|
---|
[70717] | 485 | Assert(a_pszHuman[strlen(a_pszHuman) - 1] == ':'); \
|
---|
| 486 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
| 487 | outputMachineReadableString(a_pszMachine, a_szValue); \
|
---|
| 488 | else \
|
---|
| 489 | RTPrintf("%-28s %s\n", a_pszHuman, a_szValue); \
|
---|
| 490 | } while (0)
|
---|
| 491 |
|
---|
| 492 | #define SHOW_BSTR_STRING(a_pszMachine, a_pszHuman, a_bstrValue) \
|
---|
| 493 | do \
|
---|
| 494 | { \
|
---|
| 495 | Assert(a_pszHuman[strlen(a_pszHuman) - 1] == ':'); \
|
---|
| 496 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
| 497 | outputMachineReadableString(a_pszMachine, &a_bstrValue); \
|
---|
| 498 | else \
|
---|
| 499 | RTPrintf("%-28s %ls\n", a_pszHuman, a_bstrValue.raw()); \
|
---|
| 500 | } while (0)
|
---|
| 501 |
|
---|
| 502 | #define SHOW_BOOL_VALUE_EX(a_pszMachine, a_pszHuman, a_fValue, a_szTrue, a_szFalse) \
|
---|
| 503 | do \
|
---|
| 504 | { \
|
---|
| 505 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
| 506 | outputMachineReadableString(a_pszMachine, a_fValue ? "on" : "off"); \
|
---|
| 507 | else \
|
---|
| 508 | RTPrintf("%-28s %s\n", a_pszHuman, a_fValue ? a_szTrue: a_szFalse); \
|
---|
| 509 | } while (0)
|
---|
| 510 |
|
---|
| 511 | #define SHOW_BOOL_VALUE(a_pszMachine, a_pszHuman, a_fValue) \
|
---|
| 512 | SHOW_BOOL_VALUE_EX(a_pszMachine, a_pszHuman, a_fValue, "enabled", "disabled")
|
---|
| 513 |
|
---|
| 514 | #define SHOW_ULONG_VALUE(a_pszMachine, a_pszHuman, a_uValue, a_pszUnit) \
|
---|
| 515 | do \
|
---|
| 516 | { \
|
---|
| 517 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
| 518 | RTPrintf("%s=%u\n", a_pszMachine, a_uValue); \
|
---|
| 519 | else \
|
---|
| 520 | RTPrintf("%-28s %u%s\n", a_pszHuman, a_uValue, a_pszUnit); \
|
---|
| 521 | } while (0)
|
---|
| 522 |
|
---|
| 523 | #define SHOW_LONG64_VALUE(a_pszMachine, a_pszHuman, a_llValue, a_pszUnit) \
|
---|
| 524 | do \
|
---|
| 525 | { \
|
---|
| 526 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
| 527 | RTPrintf("%s=%lld\n", a_pszMachine, a_llValue); \
|
---|
| 528 | else \
|
---|
| 529 | RTPrintf("%-28s %lld%s\n", a_pszHuman, a_llValue, a_pszUnit); \
|
---|
| 530 | } while (0)
|
---|
| 531 |
|
---|
| 532 | #define SHOW_BOOLEAN_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
|
---|
| 533 | SHOW_BOOLEAN_PROP_EX(a_pObj, a_Prop, a_pszMachine, a_pszHuman, "enabled", "disabled")
|
---|
| 534 |
|
---|
| 535 | #define SHOW_BOOLEAN_PROP_EX(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_szTrue, a_szFalse) \
|
---|
| 536 | do \
|
---|
| 537 | { \
|
---|
[40418] | 538 | BOOL f; \
|
---|
[56118] | 539 | CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&f), hrcCheck); \
|
---|
[40418] | 540 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
[70717] | 541 | outputMachineReadableString(a_pszMachine, f ? "on" : "off"); \
|
---|
[40418] | 542 | else \
|
---|
[70717] | 543 | RTPrintf("%-28s %s\n", a_pszHuman, f ? a_szTrue : a_szFalse); \
|
---|
[40419] | 544 | } while (0)
|
---|
| 545 |
|
---|
[70717] | 546 | #define SHOW_BOOLEAN_METHOD(a_pObj, a_Invocation, a_pszMachine, a_pszHuman) \
|
---|
[40419] | 547 | do \
|
---|
| 548 | { \
|
---|
| 549 | BOOL f; \
|
---|
[56118] | 550 | CHECK_ERROR2I_RET(a_pObj, a_Invocation, hrcCheck); \
|
---|
[40419] | 551 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
[70717] | 552 | outputMachineReadableString(a_pszMachine, f ? "on" : "off"); \
|
---|
[40419] | 553 | else \
|
---|
[70717] | 554 | RTPrintf("%-28s %s\n", a_pszHuman, f ? "enabled" : "disabled"); \
|
---|
[40418] | 555 | } while (0)
|
---|
| 556 |
|
---|
[70717] | 557 | #define SHOW_STRING_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
|
---|
[40418] | 558 | do \
|
---|
| 559 | { \
|
---|
| 560 | Bstr bstr; \
|
---|
[56118] | 561 | CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
|
---|
[40418] | 562 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
[70717] | 563 | outputMachineReadableString(a_pszMachine, &bstr); \
|
---|
[40418] | 564 | else \
|
---|
[70717] | 565 | RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \
|
---|
[40418] | 566 | } while (0)
|
---|
| 567 |
|
---|
[70717] | 568 | #define SHOW_STRING_PROP_NOT_EMPTY(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
|
---|
| 569 | do \
|
---|
| 570 | { \
|
---|
| 571 | Bstr bstr; \
|
---|
| 572 | CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
|
---|
| 573 | if (bstr.isNotEmpty()) \
|
---|
| 574 | { \
|
---|
| 575 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
| 576 | outputMachineReadableString(a_pszMachine, &bstr); \
|
---|
| 577 | else \
|
---|
| 578 | RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \
|
---|
| 579 | } \
|
---|
| 580 | } while (0)
|
---|
| 581 |
|
---|
[60410] | 582 | /** @def SHOW_STRING_PROP_MAJ
|
---|
| 583 | * For not breaking the output in a dot release we don't show default values. */
|
---|
[70717] | 584 | #define SHOW_STRING_PROP_MAJ(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_pszUnless, a_uMajorVer) \
|
---|
[60410] | 585 | do \
|
---|
| 586 | { \
|
---|
| 587 | Bstr bstr; \
|
---|
| 588 | CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
|
---|
[70717] | 589 | if ((a_uMajorVer) <= VBOX_VERSION_MAJOR || !bstr.equals(a_pszUnless)) \
|
---|
[60410] | 590 | { \
|
---|
| 591 | if (details == VMINFO_MACHINEREADABLE)\
|
---|
[70717] | 592 | outputMachineReadableString(a_pszMachine, &bstr); \
|
---|
[60410] | 593 | else \
|
---|
[70717] | 594 | RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \
|
---|
[60410] | 595 | } \
|
---|
| 596 | } while (0)
|
---|
| 597 |
|
---|
[70717] | 598 | #define SHOW_STRINGARRAY_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
|
---|
[42129] | 599 | do \
|
---|
| 600 | { \
|
---|
| 601 | SafeArray<BSTR> array; \
|
---|
[56118] | 602 | CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(ComSafeArrayAsOutParam(array)), hrcCheck); \
|
---|
[42129] | 603 | Utf8Str str; \
|
---|
| 604 | for (size_t i = 0; i < array.size(); i++) \
|
---|
| 605 | { \
|
---|
| 606 | if (i != 0) \
|
---|
| 607 | str.append(","); \
|
---|
| 608 | str.append(Utf8Str(array[i]).c_str()); \
|
---|
| 609 | } \
|
---|
| 610 | Bstr bstr(str); \
|
---|
| 611 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
[70717] | 612 | outputMachineReadableString(a_pszMachine, &bstr); \
|
---|
[42129] | 613 | else \
|
---|
[70717] | 614 | RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \
|
---|
[42129] | 615 | } while (0)
|
---|
| 616 |
|
---|
[70717] | 617 | #define SHOW_UUID_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
|
---|
| 618 | SHOW_STRING_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman)
|
---|
[40418] | 619 |
|
---|
[70717] | 620 | #define SHOW_USHORT_PROP_EX2(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_pszUnit, a_szFmtMachine, a_szFmtHuman) \
|
---|
[40419] | 621 | do \
|
---|
| 622 | { \
|
---|
[70717] | 623 | USHORT u16 = 0; \
|
---|
| 624 | CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&u16), hrcCheck); \
|
---|
| 625 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
| 626 | RTPrintf("%s=" a_szFmtMachine "\n", a_pszMachine, u16); \
|
---|
| 627 | else \
|
---|
| 628 | RTPrintf("%-28s " a_szFmtHuman "%s\n", a_pszHuman, u16, u16, a_pszUnit); \
|
---|
| 629 | } while (0)
|
---|
| 630 |
|
---|
| 631 | #define SHOW_ULONG_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_pszUnit) \
|
---|
| 632 | do \
|
---|
| 633 | { \
|
---|
| 634 | ULONG u32 = 0; \
|
---|
[56118] | 635 | CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&u32), hrcCheck); \
|
---|
[40419] | 636 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
[70717] | 637 | RTPrintf("%s=%u\n", a_pszMachine, u32); \
|
---|
[40419] | 638 | else \
|
---|
[70717] | 639 | RTPrintf("%-28s %u%s\n", a_pszHuman, u32, a_pszUnit); \
|
---|
[40419] | 640 | } while (0)
|
---|
| 641 |
|
---|
[70717] | 642 | #define SHOW_LONG64_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_pszUnit) \
|
---|
[40419] | 643 | do \
|
---|
| 644 | { \
|
---|
[70717] | 645 | LONG64 i64 = 0; \
|
---|
[56118] | 646 | CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&i64), hrcCheck); \
|
---|
[40419] | 647 | if (details == VMINFO_MACHINEREADABLE) \
|
---|
[70717] | 648 | RTPrintf("%s=%lld\n", a_pszMachine, i64); \
|
---|
[40419] | 649 | else \
|
---|
[70717] | 650 | RTPrintf("%-28s %'lld%s\n", a_pszHuman, i64, a_pszUnit); \
|
---|
[40419] | 651 | } while (0)
|
---|
| 652 |
|
---|
[4779] | 653 | /*
|
---|
| 654 | * The rules for output in -argdump format:
|
---|
[40418] | 655 | * 1) the key part (the [0-9a-zA-Z_\-]+ string before the '=' delimiter)
|
---|
[4779] | 656 | * is all lowercase for "VBoxManage modifyvm" parameters. Any
|
---|
| 657 | * other values printed are in CamelCase.
|
---|
| 658 | * 2) strings (anything non-decimal) are printed surrounded by
|
---|
| 659 | * double quotes '"'. If the strings themselves contain double
|
---|
| 660 | * quotes, these characters are escaped by '\'. Any '\' character
|
---|
| 661 | * in the original string is also escaped by '\'.
|
---|
| 662 | * 3) numbers (containing just [0-9\-]) are written out unchanged.
|
---|
| 663 | */
|
---|
| 664 |
|
---|
[40419] | 665 | BOOL fAccessible;
|
---|
[56118] | 666 | CHECK_ERROR2I_RET(machine, COMGETTER(Accessible)(&fAccessible), hrcCheck);
|
---|
[40419] | 667 | if (!fAccessible)
|
---|
[1] | 668 | {
|
---|
[40419] | 669 | Bstr uuid;
|
---|
| 670 | machine->COMGETTER(Id)(uuid.asOutParam());
|
---|
[17078] | 671 | if (details == VMINFO_COMPACT)
|
---|
[31539] | 672 | RTPrintf("\"<inaccessible>\" {%s}\n", Utf8Str(uuid).c_str());
|
---|
[4779] | 673 | else
|
---|
| 674 | {
|
---|
[17078] | 675 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 676 | RTPrintf("name=\"<inaccessible>\"\n");
|
---|
| 677 | else
|
---|
[24136] | 678 | RTPrintf("Name: <inaccessible!>\n");
|
---|
[17078] | 679 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[31539] | 680 | RTPrintf("UUID=\"%s\"\n", Utf8Str(uuid).c_str());
|
---|
[17078] | 681 | else
|
---|
[31539] | 682 | RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
|
---|
[17078] | 683 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 684 | {
|
---|
| 685 | Bstr settingsFilePath;
|
---|
[24136] | 686 | rc = machine->COMGETTER(SettingsFilePath)(settingsFilePath.asOutParam());
|
---|
[38735] | 687 | RTPrintf("Config file: %ls\n", settingsFilePath.raw());
|
---|
[17078] | 688 | ComPtr<IVirtualBoxErrorInfo> accessError;
|
---|
[24136] | 689 | rc = machine->COMGETTER(AccessError)(accessError.asOutParam());
|
---|
| 690 | RTPrintf("Access error details:\n");
|
---|
[35517] | 691 | ErrorInfo ei(accessError);
|
---|
[17078] | 692 | GluePrintErrorInfo(ei);
|
---|
[24136] | 693 | RTPrintf("\n");
|
---|
[17078] | 694 | }
|
---|
[4779] | 695 | }
|
---|
[1] | 696 | return S_OK;
|
---|
| 697 | }
|
---|
[459] | 698 |
|
---|
[17078] | 699 | if (details == VMINFO_COMPACT)
|
---|
| 700 | {
|
---|
[40419] | 701 | Bstr machineName;
|
---|
| 702 | machine->COMGETTER(Name)(machineName.asOutParam());
|
---|
| 703 | Bstr uuid;
|
---|
| 704 | machine->COMGETTER(Id)(uuid.asOutParam());
|
---|
| 705 |
|
---|
[38735] | 706 | RTPrintf("\"%ls\" {%s}\n", machineName.raw(), Utf8Str(uuid).c_str());
|
---|
[17078] | 707 | return S_OK;
|
---|
| 708 | }
|
---|
| 709 |
|
---|
[70717] | 710 | SHOW_STRING_PROP( machine, Name, "name", "Name:");
|
---|
[72919] | 711 | SHOW_STRINGARRAY_PROP( machine, Groups, "groups", "Groups:");
|
---|
[2567] | 712 | Bstr osTypeId;
|
---|
[56118] | 713 | CHECK_ERROR2I_RET(machine, COMGETTER(OSTypeId)(osTypeId.asOutParam()), hrcCheck);
|
---|
[1] | 714 | ComPtr<IGuestOSType> osType;
|
---|
[72919] | 715 | pVirtualBox->GetGuestOSType(osTypeId.raw(), osType.asOutParam());
|
---|
| 716 | if (!osType.isNull())
|
---|
| 717 | SHOW_STRING_PROP( osType, Description, "ostype", "Guest OS:");
|
---|
| 718 | else
|
---|
| 719 | SHOW_STRING_PROP( machine, OSTypeId, "ostype", "Guest OS:");
|
---|
[70717] | 720 | SHOW_UUID_PROP( machine, Id, "UUID", "UUID:");
|
---|
| 721 | SHOW_STRING_PROP( machine, SettingsFilePath, "CfgFile", "Config file:");
|
---|
| 722 | SHOW_STRING_PROP( machine, SnapshotFolder, "SnapFldr", "Snapshot folder:");
|
---|
| 723 | SHOW_STRING_PROP( machine, LogFolder, "LogFldr", "Log folder:");
|
---|
| 724 | SHOW_UUID_PROP( machine, HardwareUUID, "hardwareuuid", "Hardware UUID:");
|
---|
[40419] | 725 | SHOW_ULONG_PROP( machine, MemorySize, "memory", "Memory size", "MB");
|
---|
[70717] | 726 | SHOW_BOOLEAN_PROP( machine, PageFusionEnabled, "pagefusion", "Page Fusion:");
|
---|
| 727 | SHOW_ULONG_PROP( machine, VRAMSize, "vram", "VRAM size:", "MB");
|
---|
| 728 | SHOW_ULONG_PROP( machine, CPUExecutionCap, "cpuexecutioncap", "CPU exec cap:", "%");
|
---|
| 729 | SHOW_BOOLEAN_PROP( machine, HPETEnabled, "hpet", "HPET:");
|
---|
| 730 | SHOW_STRING_PROP_MAJ( machine, CPUProfile, "cpu-profile", "CPUProfile:", "host", 6);
|
---|
[1] | 731 |
|
---|
[40419] | 732 | ChipsetType_T chipsetType;
|
---|
[56118] | 733 | CHECK_ERROR2I_RET(machine, COMGETTER(ChipsetType)(&chipsetType), hrcCheck);
|
---|
[40419] | 734 | const char *pszChipsetType;
|
---|
[33020] | 735 | switch (chipsetType)
|
---|
| 736 | {
|
---|
[40419] | 737 | case ChipsetType_Null: pszChipsetType = "invalid"; break;
|
---|
| 738 | case ChipsetType_PIIX3: pszChipsetType = "piix3"; break;
|
---|
| 739 | case ChipsetType_ICH9: pszChipsetType = "ich9"; break;
|
---|
| 740 | default: AssertFailed(); pszChipsetType = "unknown"; break;
|
---|
[33020] | 741 | }
|
---|
[70717] | 742 | SHOW_UTF8_STRING("chipset", "Chipset:", pszChipsetType);
|
---|
[33020] | 743 |
|
---|
[40419] | 744 | FirmwareType_T firmwareType;
|
---|
[56118] | 745 | CHECK_ERROR2I_RET(machine, COMGETTER(FirmwareType)(&firmwareType), hrcCheck);
|
---|
[40419] | 746 | const char *pszFirmwareType;
|
---|
[33020] | 747 | switch (firmwareType)
|
---|
| 748 | {
|
---|
[40419] | 749 | case FirmwareType_BIOS: pszFirmwareType = "BIOS"; break;
|
---|
| 750 | case FirmwareType_EFI: pszFirmwareType = "EFI"; break;
|
---|
| 751 | case FirmwareType_EFI32: pszFirmwareType = "EFI32"; break;
|
---|
| 752 | case FirmwareType_EFI64: pszFirmwareType = "EFI64"; break;
|
---|
| 753 | case FirmwareType_EFIDUAL: pszFirmwareType = "EFIDUAL"; break;
|
---|
| 754 | default: AssertFailed(); pszFirmwareType = "unknown"; break;
|
---|
[33020] | 755 | }
|
---|
[70717] | 756 | SHOW_UTF8_STRING("firmware", "Firmware:", pszFirmwareType);
|
---|
[33020] | 757 |
|
---|
[70717] | 758 | SHOW_ULONG_PROP( machine, CPUCount, "cpus", "Number of CPUs:", "");
|
---|
| 759 | SHOW_BOOLEAN_METHOD( machine, GetCPUProperty(CPUPropertyType_PAE, &f), "pae", "PAE:");
|
---|
| 760 | SHOW_BOOLEAN_METHOD( machine, GetCPUProperty(CPUPropertyType_LongMode, &f), "longmode", "Long Mode:");
|
---|
| 761 | SHOW_BOOLEAN_METHOD( machine, GetCPUProperty(CPUPropertyType_TripleFaultReset, &f), "triplefaultreset", "Triple Fault Reset:");
|
---|
| 762 | SHOW_BOOLEAN_METHOD( machine, GetCPUProperty(CPUPropertyType_APIC, &f), "apic", "APIC:");
|
---|
| 763 | SHOW_BOOLEAN_METHOD( machine, GetCPUProperty(CPUPropertyType_X2APIC, &f), "x2apic", "X2APIC:");
|
---|
[70719] | 764 | SHOW_BOOLEAN_METHOD( machine, GetCPUProperty(CPUPropertyType_HWVirt, &f), "nested-hw-virt", "Nested VT-x/AMD-V:");
|
---|
[70717] | 765 | SHOW_ULONG_PROP( machine, CPUIDPortabilityLevel, "cpuid-portability-level", "CPUID Portability Level:", "");
|
---|
[33020] | 766 |
|
---|
[24404] | 767 | if (details != VMINFO_MACHINEREADABLE)
|
---|
[70717] | 768 | RTPrintf("%-28s ", "CPUID overrides:");
|
---|
[68938] | 769 | ULONG uOrdinal = 0;
|
---|
| 770 | for (uOrdinal = 0; uOrdinal < _4K; uOrdinal++)
|
---|
[24404] | 771 | {
|
---|
[68938] | 772 | ULONG uLeaf, uSubLeaf, uEAX, uEBX, uECX, uEDX;
|
---|
| 773 | rc = machine->GetCPUIDLeafByOrdinal(uOrdinal, &uLeaf, &uSubLeaf, &uEAX, &uEBX, &uECX, &uEDX);
|
---|
| 774 | if (SUCCEEDED(rc))
|
---|
[24404] | 775 | {
|
---|
[68938] | 776 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 777 | RTPrintf("cpuid=%08x,%08x,%08x,%08x,%08x,%08x", uLeaf, uSubLeaf, uEAX, uEBX, uECX, uEDX);
|
---|
| 778 | else
|
---|
[24404] | 779 | {
|
---|
[68938] | 780 | if (!uOrdinal)
|
---|
[70717] | 781 | RTPrintf("Leaf no. EAX EBX ECX EDX\n");
|
---|
| 782 | RTPrintf("%-28s %08x/%03x %08x %08x %08x %08x\n", "", uLeaf, uSubLeaf, uEAX, uEBX, uECX, uEDX);
|
---|
[24404] | 783 | }
|
---|
| 784 | }
|
---|
[68938] | 785 | else
|
---|
| 786 | {
|
---|
| 787 | if (rc != E_INVALIDARG)
|
---|
| 788 | com::GlueHandleComError(machine, "GetCPUIDLeaf", rc, __FILE__, __LINE__);
|
---|
| 789 | break;
|
---|
| 790 | }
|
---|
| 791 | }
|
---|
| 792 | if (!uOrdinal && details != VMINFO_MACHINEREADABLE)
|
---|
[24404] | 793 | RTPrintf("None\n");
|
---|
| 794 |
|
---|
[47908] | 795 | ComPtr<IBIOSSettings> biosSettings;
|
---|
[56118] | 796 | CHECK_ERROR2I_RET(machine, COMGETTER(BIOSSettings)(biosSettings.asOutParam()), hrcCheck);
|
---|
[1] | 797 |
|
---|
| 798 | BIOSBootMenuMode_T bootMenuMode;
|
---|
[56118] | 799 | CHECK_ERROR2I_RET(biosSettings, COMGETTER(BootMenuMode)(&bootMenuMode), hrcCheck);
|
---|
[40419] | 800 | const char *pszBootMenu;
|
---|
[1] | 801 | switch (bootMenuMode)
|
---|
| 802 | {
|
---|
| 803 | case BIOSBootMenuMode_Disabled:
|
---|
[4779] | 804 | pszBootMenu = "disabled";
|
---|
[1] | 805 | break;
|
---|
| 806 | case BIOSBootMenuMode_MenuOnly:
|
---|
[4779] | 807 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 808 | pszBootMenu = "menuonly";
|
---|
| 809 | else
|
---|
| 810 | pszBootMenu = "menu only";
|
---|
[1] | 811 | break;
|
---|
| 812 | default:
|
---|
[4779] | 813 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 814 | pszBootMenu = "messageandmenu";
|
---|
| 815 | else
|
---|
| 816 | pszBootMenu = "message and menu";
|
---|
[1] | 817 | }
|
---|
[70717] | 818 | SHOW_UTF8_STRING("bootmenu", "Boot menu mode:", pszBootMenu);
|
---|
[1] | 819 |
|
---|
[40419] | 820 | ComPtr<ISystemProperties> systemProperties;
|
---|
[56118] | 821 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck);
|
---|
[20252] | 822 | ULONG maxBootPosition = 0;
|
---|
[56118] | 823 | CHECK_ERROR2I_RET(systemProperties, COMGETTER(MaxBootPosition)(&maxBootPosition), hrcCheck);
|
---|
[20252] | 824 | for (ULONG i = 1; i <= maxBootPosition; i++)
|
---|
| 825 | {
|
---|
| 826 | DeviceType_T bootOrder;
|
---|
[56118] | 827 | CHECK_ERROR2I_RET(machine, GetBootOrder(i, &bootOrder), hrcCheck);
|
---|
[70717] | 828 | const char *pszDevice;
|
---|
[20252] | 829 | if (bootOrder == DeviceType_Floppy)
|
---|
[70717] | 830 | pszDevice = details == VMINFO_MACHINEREADABLE ? "floppy" : "Floppy";
|
---|
[20252] | 831 | else if (bootOrder == DeviceType_DVD)
|
---|
[70717] | 832 | pszDevice = details == VMINFO_MACHINEREADABLE ? "dvd" : "DVD";
|
---|
[20252] | 833 | else if (bootOrder == DeviceType_HardDisk)
|
---|
[70717] | 834 | pszDevice = details == VMINFO_MACHINEREADABLE ? "disk" : "HardDisk";
|
---|
[20252] | 835 | else if (bootOrder == DeviceType_Network)
|
---|
[70717] | 836 | pszDevice = details == VMINFO_MACHINEREADABLE ? "net" : "Network";
|
---|
[20252] | 837 | else if (bootOrder == DeviceType_USB)
|
---|
[70717] | 838 | pszDevice = details == VMINFO_MACHINEREADABLE ? "usb" : "USB";
|
---|
[20252] | 839 | else if (bootOrder == DeviceType_SharedFolder)
|
---|
[70717] | 840 | pszDevice = details == VMINFO_MACHINEREADABLE ? "sharedfolder" : "Shared Folder";
|
---|
[20252] | 841 | else
|
---|
[70717] | 842 | pszDevice = details == VMINFO_MACHINEREADABLE ? "none" : "Not Assigned";
|
---|
| 843 | SHOW_UTF8_STRING(FmtNm(szNm, "boot%u", i), FmtNm(szNm, "Boot Device %u:", i), pszDevice);
|
---|
[20252] | 844 | }
|
---|
| 845 |
|
---|
[70717] | 846 | SHOW_BOOLEAN_PROP(biosSettings, ACPIEnabled, "acpi", "ACPI:");
|
---|
| 847 | SHOW_BOOLEAN_PROP(biosSettings, IOAPICEnabled, "ioapic", "IOAPIC:");
|
---|
[61042] | 848 |
|
---|
| 849 | APICMode_T apicMode;
|
---|
| 850 | CHECK_ERROR2I_RET(biosSettings, COMGETTER(APICMode)(&apicMode), hrcCheck);
|
---|
| 851 | const char *pszAPIC;
|
---|
| 852 | switch (apicMode)
|
---|
| 853 | {
|
---|
| 854 | case APICMode_Disabled:
|
---|
| 855 | pszAPIC = "disabled";
|
---|
| 856 | break;
|
---|
| 857 | case APICMode_APIC:
|
---|
| 858 | default:
|
---|
| 859 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 860 | pszAPIC = "apic";
|
---|
| 861 | else
|
---|
| 862 | pszAPIC = "APIC";
|
---|
| 863 | break;
|
---|
| 864 | case APICMode_X2APIC:
|
---|
| 865 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[61096] | 866 | pszAPIC = "x2apic";
|
---|
[61042] | 867 | else
|
---|
[61096] | 868 | pszAPIC = "x2APIC";
|
---|
[61042] | 869 | break;
|
---|
| 870 | }
|
---|
[70717] | 871 | SHOW_UTF8_STRING("biosapic", "BIOS APIC mode:", pszAPIC);
|
---|
[61042] | 872 |
|
---|
[70717] | 873 | SHOW_LONG64_PROP(biosSettings, TimeOffset, "biossystemtimeoffset", "Time offset:", "ms");
|
---|
| 874 | SHOW_BOOLEAN_PROP_EX(machine, RTCUseUTC, "rtcuseutc", "RTC:", "UTC", "local time");
|
---|
| 875 | SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &f), "hwvirtex", "Hardw. virt.ext:");
|
---|
| 876 | SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &f),"nestedpaging", "Nested Paging:");
|
---|
| 877 | SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &f), "largepages", "Large Pages:");
|
---|
| 878 | SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_VPID, &f), "vtxvpid", "VT-x VPID:");
|
---|
| 879 | SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, &f), "vtxux", "VT-x unr. exec.:");
|
---|
[1] | 880 |
|
---|
[50996] | 881 | ParavirtProvider_T paravirtProvider;
|
---|
[56118] | 882 | CHECK_ERROR2I_RET(machine, COMGETTER(ParavirtProvider)(¶virtProvider), hrcCheck);
|
---|
[58450] | 883 | const char *pszParavirtProvider = paravirtProviderToString(paravirtProvider, details);
|
---|
[70717] | 884 | SHOW_UTF8_STRING("paravirtprovider", "Paravirt. Provider:", pszParavirtProvider);
|
---|
[50996] | 885 |
|
---|
[58450] | 886 | ParavirtProvider_T effParavirtProvider;
|
---|
[58452] | 887 | CHECK_ERROR2I_RET(machine, GetEffectiveParavirtProvider(&effParavirtProvider), hrcCheck);
|
---|
[58450] | 888 | const char *pszEffParavirtProvider = paravirtProviderToString(effParavirtProvider, details);
|
---|
[70717] | 889 | SHOW_UTF8_STRING("effparavirtprovider", "Effective Paravirt. Prov.:", pszEffParavirtProvider);
|
---|
[58450] | 890 |
|
---|
[58437] | 891 | Bstr paravirtDebug;
|
---|
| 892 | CHECK_ERROR2I_RET(machine, COMGETTER(ParavirtDebug)(paravirtDebug.asOutParam()), hrcCheck);
|
---|
| 893 | if (paravirtDebug.isNotEmpty())
|
---|
[70717] | 894 | SHOW_BSTR_STRING("paravirtdebug", "Paravirt. Debug:", paravirtDebug);
|
---|
[50996] | 895 |
|
---|
[1] | 896 | MachineState_T machineState;
|
---|
[56118] | 897 | CHECK_ERROR2I_RET(machine, COMGETTER(State)(&machineState), hrcCheck);
|
---|
[35907] | 898 | const char *pszState = machineStateToName(machineState, details == VMINFO_MACHINEREADABLE /*=fShort*/);
|
---|
[35707] | 899 |
|
---|
[2601] | 900 | LONG64 stateSince;
|
---|
| 901 | machine->COMGETTER(LastStateChange)(&stateSince);
|
---|
| 902 | RTTIMESPEC timeSpec;
|
---|
| 903 | RTTimeSpecSetMilli(&timeSpec, stateSince);
|
---|
| 904 | char pszTime[30] = {0};
|
---|
[10412] | 905 | RTTimeSpecToString(&timeSpec, pszTime, sizeof(pszTime));
|
---|
[4779] | 906 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 907 | {
|
---|
| 908 | RTPrintf("VMState=\"%s\"\n", pszState);
|
---|
| 909 | RTPrintf("VMStateChangeTime=\"%s\"\n", pszTime);
|
---|
[40419] | 910 |
|
---|
| 911 | Bstr stateFile;
|
---|
| 912 | machine->COMGETTER(StateFilePath)(stateFile.asOutParam());
|
---|
[23168] | 913 | if (!stateFile.isEmpty())
|
---|
[38735] | 914 | RTPrintf("VMStateFile=\"%ls\"\n", stateFile.raw());
|
---|
[4779] | 915 | }
|
---|
| 916 | else
|
---|
[70717] | 917 | RTPrintf("%-28s %s (since %s)\n", "State:", pszState, pszTime);
|
---|
[1] | 918 |
|
---|
[70717] | 919 | SHOW_ULONG_PROP( machine, MonitorCount, "monitorcount", "Monitor count:", "");
|
---|
| 920 | SHOW_BOOLEAN_PROP( machine, Accelerate3DEnabled, "accelerate3d", "3D Acceleration:");
|
---|
[22145] | 921 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
[70717] | 922 | SHOW_BOOLEAN_PROP( machine, Accelerate2DVideoEnabled, "accelerate2dvideo", "2D Video Acceleration:");
|
---|
[22145] | 923 | #endif
|
---|
[70717] | 924 | SHOW_BOOLEAN_PROP( machine, TeleporterEnabled, "teleporterenabled", "Teleporter Enabled:");
|
---|
| 925 | SHOW_ULONG_PROP( machine, TeleporterPort, "teleporterport", "Teleporter Port:", "");
|
---|
| 926 | SHOW_STRING_PROP( machine, TeleporterAddress, "teleporteraddress", "Teleporter Address:");
|
---|
| 927 | SHOW_STRING_PROP( machine, TeleporterPassword, "teleporterpassword", "Teleporter Password:");
|
---|
| 928 | SHOW_BOOLEAN_PROP( machine, TracingEnabled, "tracing-enabled", "Tracing Enabled:");
|
---|
| 929 | SHOW_BOOLEAN_PROP( machine, AllowTracingToAccessVM, "tracing-allow-vm-access", "Allow Tracing to Access VM:");
|
---|
| 930 | SHOW_STRING_PROP( machine, TracingConfig, "tracing-config", "Tracing Configuration:");
|
---|
| 931 | SHOW_BOOLEAN_PROP( machine, AutostartEnabled, "autostart-enabled", "Autostart Enabled:");
|
---|
| 932 | SHOW_ULONG_PROP( machine, AutostartDelay, "autostart-delay", "Autostart Delay:", "");
|
---|
| 933 | SHOW_STRING_PROP( machine, DefaultFrontend, "defaultfrontend", "Default Frontend:");
|
---|
[22145] | 934 |
|
---|
[77910] | 935 | VMProcPriority_T enmVMProcPriority;
|
---|
| 936 | CHECK_ERROR2I_RET(machine, COMGETTER(VMProcessPriority)(&enmVMProcPriority), hrcCheck);
|
---|
| 937 | const char *pszVMProcPriority;
|
---|
| 938 | switch (enmVMProcPriority)
|
---|
| 939 | {
|
---|
| 940 | case VMProcPriority_Flat:
|
---|
| 941 | pszVMProcPriority = "flat";
|
---|
| 942 | break;
|
---|
| 943 | case VMProcPriority_Low:
|
---|
| 944 | pszVMProcPriority = "low";
|
---|
| 945 | break;
|
---|
| 946 | case VMProcPriority_Normal:
|
---|
| 947 | pszVMProcPriority = "normal";
|
---|
| 948 | break;
|
---|
| 949 | case VMProcPriority_High:
|
---|
| 950 | pszVMProcPriority = "high";
|
---|
| 951 | break;
|
---|
| 952 | default:
|
---|
| 953 | pszVMProcPriority = "default";
|
---|
| 954 | break;
|
---|
| 955 | }
|
---|
| 956 | SHOW_UTF8_STRING("vmprocpriority", "VM process priority:", pszVMProcPriority);
|
---|
| 957 |
|
---|
[40419] | 958 | /** @todo Convert the remainder of the function to SHOW_XXX macros and add error
|
---|
| 959 | * checking where missing. */
|
---|
[23223] | 960 | /*
|
---|
[23561] | 961 | * Storage Controllers and their attached Mediums.
|
---|
[23223] | 962 | */
|
---|
[23559] | 963 | com::SafeIfaceArray<IStorageController> storageCtls;
|
---|
[32718] | 964 | CHECK_ERROR(machine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(storageCtls)));
|
---|
[23559] | 965 | for (size_t i = 0; i < storageCtls.size(); ++ i)
|
---|
[1] | 966 | {
|
---|
[23559] | 967 | ComPtr<IStorageController> storageCtl = storageCtls[i];
|
---|
| 968 | StorageControllerType_T enmCtlType = StorageControllerType_Null;
|
---|
| 969 | const char *pszCtl = NULL;
|
---|
[24375] | 970 | ULONG ulValue = 0;
|
---|
[34010] | 971 | BOOL fBootable = FALSE;
|
---|
[23559] | 972 | Bstr storageCtlName;
|
---|
[23223] | 973 |
|
---|
[23559] | 974 | storageCtl->COMGETTER(Name)(storageCtlName.asOutParam());
|
---|
| 975 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[38735] | 976 | RTPrintf("storagecontrollername%u=\"%ls\"\n", i, storageCtlName.raw());
|
---|
[23559] | 977 | else
|
---|
[38735] | 978 | RTPrintf("Storage Controller Name (%u): %ls\n", i, storageCtlName.raw());
|
---|
[17669] | 979 |
|
---|
[23559] | 980 | storageCtl->COMGETTER(ControllerType)(&enmCtlType);
|
---|
| 981 | switch (enmCtlType)
|
---|
[14371] | 982 | {
|
---|
[23559] | 983 | case StorageControllerType_LsiLogic:
|
---|
| 984 | pszCtl = "LsiLogic";
|
---|
| 985 | break;
|
---|
[48983] | 986 | case StorageControllerType_LsiLogicSas:
|
---|
| 987 | pszCtl = "LsiLogicSas";
|
---|
| 988 | break;
|
---|
[23559] | 989 | case StorageControllerType_BusLogic:
|
---|
| 990 | pszCtl = "BusLogic";
|
---|
| 991 | break;
|
---|
| 992 | case StorageControllerType_IntelAhci:
|
---|
| 993 | pszCtl = "IntelAhci";
|
---|
| 994 | break;
|
---|
[17669] | 995 | case StorageControllerType_PIIX3:
|
---|
[23559] | 996 | pszCtl = "PIIX3";
|
---|
[17669] | 997 | break;
|
---|
| 998 | case StorageControllerType_PIIX4:
|
---|
[23559] | 999 | pszCtl = "PIIX4";
|
---|
[17669] | 1000 | break;
|
---|
| 1001 | case StorageControllerType_ICH6:
|
---|
[23559] | 1002 | pszCtl = "ICH6";
|
---|
[17669] | 1003 | break;
|
---|
[23559] | 1004 | case StorageControllerType_I82078:
|
---|
| 1005 | pszCtl = "I82078";
|
---|
| 1006 | break;
|
---|
[48983] | 1007 | case StorageControllerType_USB:
|
---|
| 1008 | pszCtl = "USB";
|
---|
| 1009 | break;
|
---|
[23559] | 1010 |
|
---|
[17669] | 1011 | default:
|
---|
[23559] | 1012 | pszCtl = "unknown";
|
---|
[17669] | 1013 | }
|
---|
| 1014 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[24601] | 1015 | RTPrintf("storagecontrollertype%u=\"%s\"\n", i, pszCtl);
|
---|
[17669] | 1016 | else
|
---|
[24375] | 1017 | RTPrintf("Storage Controller Type (%u): %s\n", i, pszCtl);
|
---|
| 1018 |
|
---|
| 1019 | storageCtl->COMGETTER(Instance)(&ulValue);
|
---|
| 1020 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[24601] | 1021 | RTPrintf("storagecontrollerinstance%u=\"%lu\"\n", i, ulValue);
|
---|
[24375] | 1022 | else
|
---|
| 1023 | RTPrintf("Storage Controller Instance Number (%u): %lu\n", i, ulValue);
|
---|
| 1024 |
|
---|
| 1025 | storageCtl->COMGETTER(MaxPortCount)(&ulValue);
|
---|
| 1026 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[24601] | 1027 | RTPrintf("storagecontrollermaxportcount%u=\"%lu\"\n", i, ulValue);
|
---|
[24375] | 1028 | else
|
---|
| 1029 | RTPrintf("Storage Controller Max Port Count (%u): %lu\n", i, ulValue);
|
---|
| 1030 |
|
---|
| 1031 | storageCtl->COMGETTER(PortCount)(&ulValue);
|
---|
| 1032 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[24601] | 1033 | RTPrintf("storagecontrollerportcount%u=\"%lu\"\n", i, ulValue);
|
---|
[24375] | 1034 | else
|
---|
| 1035 | RTPrintf("Storage Controller Port Count (%u): %lu\n", i, ulValue);
|
---|
[34010] | 1036 |
|
---|
| 1037 | storageCtl->COMGETTER(Bootable)(&fBootable);
|
---|
| 1038 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1039 | RTPrintf("storagecontrollerbootable%u=\"%s\"\n", i, fBootable ? "on" : "off");
|
---|
| 1040 | else
|
---|
| 1041 | RTPrintf("Storage Controller Bootable (%u): %s\n", i, fBootable ? "on" : "off");
|
---|
[14178] | 1042 | }
|
---|
| 1043 |
|
---|
[23559] | 1044 | for (size_t j = 0; j < storageCtls.size(); ++ j)
|
---|
[1] | 1045 | {
|
---|
[23559] | 1046 | ComPtr<IStorageController> storageCtl = storageCtls[j];
|
---|
| 1047 | ComPtr<IMedium> medium;
|
---|
| 1048 | Bstr storageCtlName;
|
---|
| 1049 | Bstr filePath;
|
---|
| 1050 | ULONG cDevices;
|
---|
| 1051 | ULONG cPorts;
|
---|
| 1052 |
|
---|
| 1053 | storageCtl->COMGETTER(Name)(storageCtlName.asOutParam());
|
---|
| 1054 | storageCtl->COMGETTER(MaxDevicesPerPortCount)(&cDevices);
|
---|
| 1055 | storageCtl->COMGETTER(PortCount)(&cPorts);
|
---|
| 1056 |
|
---|
| 1057 | for (ULONG i = 0; i < cPorts; ++ i)
|
---|
[4779] | 1058 | {
|
---|
[23559] | 1059 | for (ULONG k = 0; k < cDevices; ++ k)
|
---|
| 1060 | {
|
---|
[37695] | 1061 | ComPtr<IMediumAttachment> mediumAttach;
|
---|
| 1062 | machine->GetMediumAttachment(storageCtlName.raw(),
|
---|
| 1063 | i, k,
|
---|
| 1064 | mediumAttach.asOutParam());
|
---|
| 1065 | BOOL fIsEjected = FALSE;
|
---|
[37778] | 1066 | BOOL fTempEject = FALSE;
|
---|
[37695] | 1067 | DeviceType_T devType = DeviceType_Null;
|
---|
| 1068 | if (mediumAttach)
|
---|
| 1069 | {
|
---|
[37778] | 1070 | mediumAttach->COMGETTER(TemporaryEject)(&fTempEject);
|
---|
[37695] | 1071 | mediumAttach->COMGETTER(IsEjected)(&fIsEjected);
|
---|
| 1072 | mediumAttach->COMGETTER(Type)(&devType);
|
---|
| 1073 | }
|
---|
[32718] | 1074 | rc = machine->GetMedium(storageCtlName.raw(), i, k,
|
---|
| 1075 | medium.asOutParam());
|
---|
[23559] | 1076 | if (SUCCEEDED(rc) && medium)
|
---|
| 1077 | {
|
---|
[37695] | 1078 | BOOL fPassthrough = FALSE;
|
---|
[23223] | 1079 |
|
---|
[37695] | 1080 | if (mediumAttach)
|
---|
[23559] | 1081 | mediumAttach->COMGETTER(Passthrough)(&fPassthrough);
|
---|
| 1082 |
|
---|
| 1083 | medium->COMGETTER(Location)(filePath.asOutParam());
|
---|
[40419] | 1084 | Bstr uuid;
|
---|
[23559] | 1085 | medium->COMGETTER(Id)(uuid.asOutParam());
|
---|
| 1086 |
|
---|
| 1087 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1088 | {
|
---|
[38735] | 1089 | RTPrintf("\"%ls-%d-%d\"=\"%ls\"\n", storageCtlName.raw(),
|
---|
[23559] | 1090 | i, k, filePath.raw());
|
---|
[38735] | 1091 | RTPrintf("\"%ls-ImageUUID-%d-%d\"=\"%s\"\n",
|
---|
[31539] | 1092 | storageCtlName.raw(), i, k, Utf8Str(uuid).c_str());
|
---|
[23559] | 1093 | if (fPassthrough)
|
---|
[38735] | 1094 | RTPrintf("\"%ls-dvdpassthrough\"=\"%s\"\n", storageCtlName.raw(),
|
---|
[23559] | 1095 | fPassthrough ? "on" : "off");
|
---|
[37695] | 1096 | if (devType == DeviceType_DVD)
|
---|
[37778] | 1097 | {
|
---|
[38735] | 1098 | RTPrintf("\"%ls-tempeject\"=\"%s\"\n", storageCtlName.raw(),
|
---|
[37778] | 1099 | fTempEject ? "on" : "off");
|
---|
[38735] | 1100 | RTPrintf("\"%ls-IsEjected\"=\"%s\"\n", storageCtlName.raw(),
|
---|
[37695] | 1101 | fIsEjected ? "on" : "off");
|
---|
[37778] | 1102 | }
|
---|
[23559] | 1103 | }
|
---|
| 1104 | else
|
---|
| 1105 | {
|
---|
[38735] | 1106 | RTPrintf("%ls (%d, %d): %ls (UUID: %s)",
|
---|
[23559] | 1107 | storageCtlName.raw(), i, k, filePath.raw(),
|
---|
[31539] | 1108 | Utf8Str(uuid).c_str());
|
---|
[23559] | 1109 | if (fPassthrough)
|
---|
| 1110 | RTPrintf(" (passthrough enabled)");
|
---|
[37778] | 1111 | if (fTempEject)
|
---|
| 1112 | RTPrintf(" (temp eject)");
|
---|
[37695] | 1113 | if (fIsEjected)
|
---|
| 1114 | RTPrintf(" (ejected)");
|
---|
[23559] | 1115 | RTPrintf("\n");
|
---|
| 1116 | }
|
---|
| 1117 | }
|
---|
[25099] | 1118 | else if (SUCCEEDED(rc))
|
---|
| 1119 | {
|
---|
| 1120 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[37695] | 1121 | {
|
---|
[38735] | 1122 | RTPrintf("\"%ls-%d-%d\"=\"emptydrive\"\n", storageCtlName.raw(), i, k);
|
---|
[37695] | 1123 | if (devType == DeviceType_DVD)
|
---|
[38735] | 1124 | RTPrintf("\"%ls-IsEjected\"=\"%s\"\n", storageCtlName.raw(),
|
---|
[37695] | 1125 | fIsEjected ? "on" : "off");
|
---|
| 1126 | }
|
---|
[25099] | 1127 | else
|
---|
[37695] | 1128 | {
|
---|
[38735] | 1129 | RTPrintf("%ls (%d, %d): Empty", storageCtlName.raw(), i, k);
|
---|
[37778] | 1130 | if (fTempEject)
|
---|
| 1131 | RTPrintf(" (temp eject)");
|
---|
[37695] | 1132 | if (fIsEjected)
|
---|
| 1133 | RTPrintf(" (ejected)");
|
---|
| 1134 | RTPrintf("\n");
|
---|
| 1135 | }
|
---|
[25099] | 1136 | }
|
---|
[23559] | 1137 | else
|
---|
| 1138 | {
|
---|
| 1139 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[38735] | 1140 | RTPrintf("\"%ls-%d-%d\"=\"none\"\n", storageCtlName.raw(), i, k);
|
---|
[23559] | 1141 | }
|
---|
| 1142 | }
|
---|
[1] | 1143 | }
|
---|
| 1144 | }
|
---|
| 1145 |
|
---|
[35887] | 1146 | /* get the maximum amount of NICS */
|
---|
[53266] | 1147 | ULONG maxNICs = getMaxNics(pVirtualBox, machine);
|
---|
[35887] | 1148 |
|
---|
[1] | 1149 | for (ULONG currentNIC = 0; currentNIC < maxNICs; currentNIC++)
|
---|
| 1150 | {
|
---|
| 1151 | ComPtr<INetworkAdapter> nic;
|
---|
| 1152 | rc = machine->GetNetworkAdapter(currentNIC, nic.asOutParam());
|
---|
| 1153 | if (SUCCEEDED(rc) && nic)
|
---|
| 1154 | {
|
---|
[70717] | 1155 | FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "nic%u" : "NIC %u:", currentNIC + 1);
|
---|
| 1156 |
|
---|
[1] | 1157 | BOOL fEnabled;
|
---|
| 1158 | nic->COMGETTER(Enabled)(&fEnabled);
|
---|
| 1159 | if (!fEnabled)
|
---|
| 1160 | {
|
---|
[4779] | 1161 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 1162 | RTPrintf("%s=\"none\"\n", szNm);
|
---|
[4779] | 1163 | else
|
---|
[70717] | 1164 | RTPrintf("%-28s disabled\n", szNm);
|
---|
[1] | 1165 | }
|
---|
| 1166 | else
|
---|
| 1167 | {
|
---|
| 1168 | Bstr strMACAddress;
|
---|
| 1169 | nic->COMGETTER(MACAddress)(strMACAddress.asOutParam());
|
---|
| 1170 | Utf8Str strAttachment;
|
---|
[28345] | 1171 | Utf8Str strNatSettings = "";
|
---|
| 1172 | Utf8Str strNatForwardings = "";
|
---|
[1] | 1173 | NetworkAttachmentType_T attachment;
|
---|
| 1174 | nic->COMGETTER(AttachmentType)(&attachment);
|
---|
| 1175 | switch (attachment)
|
---|
| 1176 | {
|
---|
[7207] | 1177 | case NetworkAttachmentType_Null:
|
---|
[4779] | 1178 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1179 | strAttachment = "null";
|
---|
| 1180 | else
|
---|
| 1181 | strAttachment = "none";
|
---|
[1] | 1182 | break;
|
---|
[36082] | 1183 |
|
---|
[7207] | 1184 | case NetworkAttachmentType_NAT:
|
---|
[8371] | 1185 | {
|
---|
| 1186 | Bstr strNetwork;
|
---|
[42551] | 1187 | ComPtr<INATEngine> engine;
|
---|
| 1188 | nic->COMGETTER(NATEngine)(engine.asOutParam());
|
---|
| 1189 | engine->COMGETTER(Network)(strNetwork.asOutParam());
|
---|
[28345] | 1190 | com::SafeArray<BSTR> forwardings;
|
---|
[42551] | 1191 | engine->COMGETTER(Redirects)(ComSafeArrayAsOutParam(forwardings));
|
---|
[28345] | 1192 | strNatForwardings = "";
|
---|
| 1193 | for (size_t i = 0; i < forwardings.size(); ++i)
|
---|
| 1194 | {
|
---|
| 1195 | bool fSkip = false;
|
---|
| 1196 | BSTR r = forwardings[i];
|
---|
| 1197 | Utf8Str utf = Utf8Str(r);
|
---|
| 1198 | Utf8Str strName;
|
---|
| 1199 | Utf8Str strProto;
|
---|
| 1200 | Utf8Str strHostPort;
|
---|
| 1201 | Utf8Str strHostIP;
|
---|
| 1202 | Utf8Str strGuestPort;
|
---|
| 1203 | Utf8Str strGuestIP;
|
---|
| 1204 | size_t pos, ppos;
|
---|
| 1205 | pos = ppos = 0;
|
---|
| 1206 | #define ITERATE_TO_NEXT_TERM(res, str, pos, ppos) \
|
---|
| 1207 | do { \
|
---|
| 1208 | pos = str.find(",", ppos); \
|
---|
| 1209 | if (pos == Utf8Str::npos) \
|
---|
| 1210 | { \
|
---|
[31539] | 1211 | Log(( #res " extracting from %s is failed\n", str.c_str())); \
|
---|
[28345] | 1212 | fSkip = true; \
|
---|
| 1213 | } \
|
---|
| 1214 | res = str.substr(ppos, pos - ppos); \
|
---|
[31539] | 1215 | Log2((#res " %s pos:%d, ppos:%d\n", res.c_str(), pos, ppos)); \
|
---|
[28345] | 1216 | ppos = pos + 1; \
|
---|
| 1217 | } while (0)
|
---|
| 1218 | ITERATE_TO_NEXT_TERM(strName, utf, pos, ppos);
|
---|
| 1219 | if (fSkip) continue;
|
---|
| 1220 | ITERATE_TO_NEXT_TERM(strProto, utf, pos, ppos);
|
---|
| 1221 | if (fSkip) continue;
|
---|
| 1222 | ITERATE_TO_NEXT_TERM(strHostIP, utf, pos, ppos);
|
---|
| 1223 | if (fSkip) continue;
|
---|
| 1224 | ITERATE_TO_NEXT_TERM(strHostPort, utf, pos, ppos);
|
---|
| 1225 | if (fSkip) continue;
|
---|
| 1226 | ITERATE_TO_NEXT_TERM(strGuestIP, utf, pos, ppos);
|
---|
| 1227 | if (fSkip) continue;
|
---|
| 1228 | strGuestPort = utf.substr(ppos, utf.length() - ppos);
|
---|
| 1229 | #undef ITERATE_TO_NEXT_TERM
|
---|
| 1230 | switch (strProto.toUInt32())
|
---|
| 1231 | {
|
---|
| 1232 | case NATProtocol_TCP:
|
---|
| 1233 | strProto = "tcp";
|
---|
| 1234 | break;
|
---|
| 1235 | case NATProtocol_UDP:
|
---|
| 1236 | strProto = "udp";
|
---|
| 1237 | break;
|
---|
| 1238 | default:
|
---|
| 1239 | strProto = "unk";
|
---|
| 1240 | break;
|
---|
| 1241 | }
|
---|
| 1242 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1243 | {
|
---|
[28434] | 1244 | strNatForwardings = Utf8StrFmt("%sForwarding(%d)=\"%s,%s,%s,%s,%s,%s\"\n",
|
---|
[31539] | 1245 | strNatForwardings.c_str(), i, strName.c_str(), strProto.c_str(),
|
---|
| 1246 | strHostIP.c_str(), strHostPort.c_str(),
|
---|
| 1247 | strGuestIP.c_str(), strGuestPort.c_str());
|
---|
[28345] | 1248 | }
|
---|
| 1249 | else
|
---|
| 1250 | {
|
---|
| 1251 | strNatForwardings = Utf8StrFmt("%sNIC %d Rule(%d): name = %s, protocol = %s,"
|
---|
[28434] | 1252 | " host ip = %s, host port = %s, guest ip = %s, guest port = %s\n",
|
---|
[31539] | 1253 | strNatForwardings.c_str(), currentNIC + 1, i, strName.c_str(), strProto.c_str(),
|
---|
| 1254 | strHostIP.c_str(), strHostPort.c_str(),
|
---|
| 1255 | strGuestIP.c_str(), strGuestPort.c_str());
|
---|
[28345] | 1256 | }
|
---|
| 1257 | }
|
---|
| 1258 | ULONG mtu = 0;
|
---|
| 1259 | ULONG sockSnd = 0;
|
---|
| 1260 | ULONG sockRcv = 0;
|
---|
| 1261 | ULONG tcpSnd = 0;
|
---|
| 1262 | ULONG tcpRcv = 0;
|
---|
[42551] | 1263 | engine->GetNetworkSettings(&mtu, &sockSnd, &sockRcv, &tcpSnd, &tcpRcv);
|
---|
[28434] | 1264 |
|
---|
[52037] | 1265 | /** @todo r=klaus dnsproxy etc needs to be dumped, too */
|
---|
[4779] | 1266 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[8371] | 1267 | {
|
---|
[38735] | 1268 | RTPrintf("natnet%d=\"%ls\"\n", currentNIC + 1, strNetwork.length() ? strNetwork.raw(): Bstr("nat").raw());
|
---|
[4779] | 1269 | strAttachment = "nat";
|
---|
[28345] | 1270 | strNatSettings = Utf8StrFmt("mtu=\"%d\"\nsockSnd=\"%d\"\nsockRcv=\"%d\"\ntcpWndSnd=\"%d\"\ntcpWndRcv=\"%d\"\n",
|
---|
[49621] | 1271 | mtu, sockSnd ? sockSnd : 64, sockRcv ? sockRcv : 64, tcpSnd ? tcpSnd : 64, tcpRcv ? tcpRcv : 64);
|
---|
[8371] | 1272 | }
|
---|
[4779] | 1273 | else
|
---|
[28345] | 1274 | {
|
---|
[4779] | 1275 | strAttachment = "NAT";
|
---|
[36114] | 1276 | strNatSettings = Utf8StrFmt("NIC %d Settings: MTU: %d, Socket (send: %d, receive: %d), TCP Window (send:%d, receive: %d)\n",
|
---|
[49621] | 1277 | currentNIC + 1, mtu, sockSnd ? sockSnd : 64, sockRcv ? sockRcv : 64, tcpSnd ? tcpSnd : 64, tcpRcv ? tcpRcv : 64);
|
---|
[28345] | 1278 | }
|
---|
[1] | 1279 | break;
|
---|
[8371] | 1280 | }
|
---|
[36082] | 1281 |
|
---|
[17275] | 1282 | case NetworkAttachmentType_Bridged:
|
---|
[4779] | 1283 | {
|
---|
[17323] | 1284 | Bstr strBridgeAdp;
|
---|
[37200] | 1285 | nic->COMGETTER(BridgedInterface)(strBridgeAdp.asOutParam());
|
---|
[4779] | 1286 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1287 | {
|
---|
[38735] | 1288 | RTPrintf("bridgeadapter%d=\"%ls\"\n", currentNIC + 1, strBridgeAdp.raw());
|
---|
[17322] | 1289 | strAttachment = "bridged";
|
---|
[4779] | 1290 | }
|
---|
| 1291 | else
|
---|
[38735] | 1292 | strAttachment = Utf8StrFmt("Bridged Interface '%ls'", strBridgeAdp.raw());
|
---|
[1] | 1293 | break;
|
---|
[4779] | 1294 | }
|
---|
[36082] | 1295 |
|
---|
[7207] | 1296 | case NetworkAttachmentType_Internal:
|
---|
[1] | 1297 | {
|
---|
| 1298 | Bstr strNetwork;
|
---|
| 1299 | nic->COMGETTER(InternalNetwork)(strNetwork.asOutParam());
|
---|
[4779] | 1300 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1301 | {
|
---|
[38735] | 1302 | RTPrintf("intnet%d=\"%ls\"\n", currentNIC + 1, strNetwork.raw());
|
---|
[4779] | 1303 | strAttachment = "intnet";
|
---|
| 1304 | }
|
---|
| 1305 | else
|
---|
[31539] | 1306 | strAttachment = Utf8StrFmt("Internal Network '%s'", Utf8Str(strNetwork).c_str());
|
---|
[1] | 1307 | break;
|
---|
| 1308 | }
|
---|
[36082] | 1309 |
|
---|
[16509] | 1310 | case NetworkAttachmentType_HostOnly:
|
---|
| 1311 | {
|
---|
[17323] | 1312 | Bstr strHostonlyAdp;
|
---|
[37200] | 1313 | nic->COMGETTER(HostOnlyInterface)(strHostonlyAdp.asOutParam());
|
---|
[16509] | 1314 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1315 | {
|
---|
[38735] | 1316 | RTPrintf("hostonlyadapter%d=\"%ls\"\n", currentNIC + 1, strHostonlyAdp.raw());
|
---|
[16509] | 1317 | strAttachment = "hostonly";
|
---|
| 1318 | }
|
---|
| 1319 | else
|
---|
[38735] | 1320 | strAttachment = Utf8StrFmt("Host-only Interface '%ls'", strHostonlyAdp.raw());
|
---|
[16509] | 1321 | break;
|
---|
| 1322 | }
|
---|
[48538] | 1323 |
|
---|
[37200] | 1324 | case NetworkAttachmentType_Generic:
|
---|
[29117] | 1325 | {
|
---|
[37200] | 1326 | Bstr strGenericDriver;
|
---|
| 1327 | nic->COMGETTER(GenericDriver)(strGenericDriver.asOutParam());
|
---|
[29117] | 1328 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1329 | {
|
---|
[38735] | 1330 | RTPrintf("generic%d=\"%ls\"\n", currentNIC + 1, strGenericDriver.raw());
|
---|
[37200] | 1331 | strAttachment = "Generic";
|
---|
[29117] | 1332 | }
|
---|
| 1333 | else
|
---|
[37395] | 1334 | {
|
---|
[38735] | 1335 | strAttachment = Utf8StrFmt("Generic '%ls'", strGenericDriver.raw());
|
---|
[37395] | 1336 |
|
---|
| 1337 | // show the generic properties
|
---|
| 1338 | com::SafeArray<BSTR> aProperties;
|
---|
| 1339 | com::SafeArray<BSTR> aValues;
|
---|
[37401] | 1340 | rc = nic->GetProperties(NULL,
|
---|
| 1341 | ComSafeArrayAsOutParam(aProperties),
|
---|
| 1342 | ComSafeArrayAsOutParam(aValues));
|
---|
| 1343 | if (SUCCEEDED(rc))
|
---|
[37395] | 1344 | {
|
---|
| 1345 | strAttachment += " { ";
|
---|
[37401] | 1346 | for (unsigned i = 0; i < aProperties.size(); ++i)
|
---|
[38735] | 1347 | strAttachment += Utf8StrFmt(!i ? "%ls='%ls'" : ", %ls='%ls'",
|
---|
[37401] | 1348 | aProperties[i], aValues[i]);
|
---|
[37395] | 1349 | strAttachment += " }";
|
---|
| 1350 | }
|
---|
| 1351 | }
|
---|
[29117] | 1352 | break;
|
---|
| 1353 | }
|
---|
[48538] | 1354 |
|
---|
| 1355 | case NetworkAttachmentType_NATNetwork:
|
---|
| 1356 | {
|
---|
| 1357 | Bstr strNetwork;
|
---|
| 1358 | nic->COMGETTER(NATNetwork)(strNetwork.asOutParam());
|
---|
| 1359 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1360 | {
|
---|
| 1361 | RTPrintf("nat-network%d=\"%ls\"\n", currentNIC + 1, strNetwork.raw());
|
---|
| 1362 | strAttachment = "natnetwork";
|
---|
| 1363 | }
|
---|
| 1364 | else
|
---|
| 1365 | strAttachment = Utf8StrFmt("NAT Network '%s'", Utf8Str(strNetwork).c_str());
|
---|
| 1366 | break;
|
---|
| 1367 | }
|
---|
| 1368 |
|
---|
[1] | 1369 | default:
|
---|
| 1370 | strAttachment = "unknown";
|
---|
| 1371 | break;
|
---|
| 1372 | }
|
---|
| 1373 |
|
---|
[4779] | 1374 | /* cable connected */
|
---|
| 1375 | BOOL fConnected;
|
---|
| 1376 | nic->COMGETTER(CableConnected)(&fConnected);
|
---|
| 1377 |
|
---|
[36082] | 1378 | /* promisc policy */
|
---|
| 1379 | NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
|
---|
[56118] | 1380 | CHECK_ERROR2I_RET(nic, COMGETTER(PromiscModePolicy)(&enmPromiscModePolicy), hrcCheck);
|
---|
[36082] | 1381 | const char *pszPromiscuousGuestPolicy;
|
---|
| 1382 | switch (enmPromiscModePolicy)
|
---|
| 1383 | {
|
---|
| 1384 | case NetworkAdapterPromiscModePolicy_Deny: pszPromiscuousGuestPolicy = "deny"; break;
|
---|
| 1385 | case NetworkAdapterPromiscModePolicy_AllowNetwork: pszPromiscuousGuestPolicy = "allow-vms"; break;
|
---|
| 1386 | case NetworkAdapterPromiscModePolicy_AllowAll: pszPromiscuousGuestPolicy = "allow-all"; break;
|
---|
[43463] | 1387 | default: AssertFailedReturn(E_INVALIDARG);
|
---|
[36082] | 1388 | }
|
---|
| 1389 |
|
---|
[1] | 1390 | /* trace stuff */
|
---|
| 1391 | BOOL fTraceEnabled;
|
---|
| 1392 | nic->COMGETTER(TraceEnabled)(&fTraceEnabled);
|
---|
| 1393 | Bstr traceFile;
|
---|
| 1394 | nic->COMGETTER(TraceFile)(traceFile.asOutParam());
|
---|
| 1395 |
|
---|
[5129] | 1396 | /* NIC type */
|
---|
[5130] | 1397 | NetworkAdapterType_T NICType;
|
---|
[5129] | 1398 | nic->COMGETTER(AdapterType)(&NICType);
|
---|
[36082] | 1399 | const char *pszNICType;
|
---|
| 1400 | switch (NICType)
|
---|
| 1401 | {
|
---|
| 1402 | case NetworkAdapterType_Am79C970A: pszNICType = "Am79C970A"; break;
|
---|
| 1403 | case NetworkAdapterType_Am79C973: pszNICType = "Am79C973"; break;
|
---|
[6968] | 1404 | #ifdef VBOX_WITH_E1000
|
---|
[36082] | 1405 | case NetworkAdapterType_I82540EM: pszNICType = "82540EM"; break;
|
---|
| 1406 | case NetworkAdapterType_I82543GC: pszNICType = "82543GC"; break;
|
---|
| 1407 | case NetworkAdapterType_I82545EM: pszNICType = "82545EM"; break;
|
---|
[6968] | 1408 | #endif
|
---|
[22866] | 1409 | #ifdef VBOX_WITH_VIRTIO
|
---|
[36082] | 1410 | case NetworkAdapterType_Virtio: pszNICType = "virtio"; break;
|
---|
| 1411 | #endif
|
---|
| 1412 | default: AssertFailed(); pszNICType = "unknown"; break;
|
---|
[5129] | 1413 | }
|
---|
| 1414 |
|
---|
| 1415 | /* reported line speed */
|
---|
| 1416 | ULONG ulLineSpeed;
|
---|
| 1417 | nic->COMGETTER(LineSpeed)(&ulLineSpeed);
|
---|
| 1418 |
|
---|
[28106] | 1419 | /* boot priority of the adapter */
|
---|
| 1420 | ULONG ulBootPriority;
|
---|
| 1421 | nic->COMGETTER(BootPriority)(&ulBootPriority);
|
---|
| 1422 |
|
---|
[40469] | 1423 | /* bandwidth group */
|
---|
| 1424 | ComObjPtr<IBandwidthGroup> pBwGroup;
|
---|
| 1425 | Bstr strBwGroup;
|
---|
| 1426 | nic->COMGETTER(BandwidthGroup)(pBwGroup.asOutParam());
|
---|
| 1427 | if (!pBwGroup.isNull())
|
---|
| 1428 | pBwGroup->COMGETTER(Name)(strBwGroup.asOutParam());
|
---|
| 1429 |
|
---|
[4779] | 1430 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1431 | {
|
---|
[38735] | 1432 | RTPrintf("macaddress%d=\"%ls\"\n", currentNIC + 1, strMACAddress.raw());
|
---|
[4779] | 1433 | RTPrintf("cableconnected%d=\"%s\"\n", currentNIC + 1, fConnected ? "on" : "off");
|
---|
[31539] | 1434 | RTPrintf("nic%d=\"%s\"\n", currentNIC + 1, strAttachment.c_str());
|
---|
[43422] | 1435 | RTPrintf("nictype%d=\"%s\"\n", currentNIC + 1, pszNICType);
|
---|
| 1436 | RTPrintf("nicspeed%d=\"%d\"\n", currentNIC + 1, ulLineSpeed);
|
---|
[4779] | 1437 | }
|
---|
| 1438 | else
|
---|
[70717] | 1439 | RTPrintf("%-28s MAC: %ls, Attachment: %s, Cable connected: %s, Trace: %s (file: %ls), Type: %s, Reported speed: %d Mbps, Boot priority: %d, Promisc Policy: %s, Bandwidth group: %ls\n",
|
---|
| 1440 | szNm, strMACAddress.raw(), strAttachment.c_str(),
|
---|
[4779] | 1441 | fConnected ? "on" : "off",
|
---|
[8382] | 1442 | fTraceEnabled ? "on" : "off",
|
---|
| 1443 | traceFile.isEmpty() ? Bstr("none").raw() : traceFile.raw(),
|
---|
[36082] | 1444 | pszNICType,
|
---|
[28106] | 1445 | ulLineSpeed / 1000,
|
---|
[36082] | 1446 | (int)ulBootPriority,
|
---|
[40469] | 1447 | pszPromiscuousGuestPolicy,
|
---|
| 1448 | strBwGroup.isEmpty() ? Bstr("none").raw() : strBwGroup.raw());
|
---|
[28345] | 1449 | if (strNatSettings.length())
|
---|
[31539] | 1450 | RTPrintf(strNatSettings.c_str());
|
---|
[28345] | 1451 | if (strNatForwardings.length())
|
---|
[31539] | 1452 | RTPrintf(strNatForwardings.c_str());
|
---|
[1] | 1453 | }
|
---|
| 1454 | }
|
---|
| 1455 | }
|
---|
| 1456 |
|
---|
[26936] | 1457 | /* Pointing device information */
|
---|
[42551] | 1458 | PointingHIDType_T aPointingHID;
|
---|
| 1459 | const char *pszHID = "Unknown";
|
---|
| 1460 | const char *pszMrHID = "unknown";
|
---|
| 1461 | machine->COMGETTER(PointingHIDType)(&aPointingHID);
|
---|
| 1462 | switch (aPointingHID)
|
---|
[26936] | 1463 | {
|
---|
[42551] | 1464 | case PointingHIDType_None:
|
---|
| 1465 | pszHID = "None";
|
---|
| 1466 | pszMrHID = "none";
|
---|
[26936] | 1467 | break;
|
---|
[42551] | 1468 | case PointingHIDType_PS2Mouse:
|
---|
| 1469 | pszHID = "PS/2 Mouse";
|
---|
| 1470 | pszMrHID = "ps2mouse";
|
---|
[26936] | 1471 | break;
|
---|
[42551] | 1472 | case PointingHIDType_USBMouse:
|
---|
| 1473 | pszHID = "USB Mouse";
|
---|
| 1474 | pszMrHID = "usbmouse";
|
---|
[26936] | 1475 | break;
|
---|
[42551] | 1476 | case PointingHIDType_USBTablet:
|
---|
| 1477 | pszHID = "USB Tablet";
|
---|
| 1478 | pszMrHID = "usbtablet";
|
---|
[26936] | 1479 | break;
|
---|
[42551] | 1480 | case PointingHIDType_ComboMouse:
|
---|
| 1481 | pszHID = "USB Tablet and PS/2 Mouse";
|
---|
| 1482 | pszMrHID = "combomouse";
|
---|
[26936] | 1483 | break;
|
---|
[47246] | 1484 | case PointingHIDType_USBMultiTouch:
|
---|
| 1485 | pszHID = "USB Multi-Touch";
|
---|
| 1486 | pszMrHID = "usbmultitouch";
|
---|
| 1487 | break;
|
---|
[26936] | 1488 | default:
|
---|
| 1489 | break;
|
---|
| 1490 | }
|
---|
[70717] | 1491 | SHOW_UTF8_STRING("hidpointing", "Pointing Device:", details == VMINFO_MACHINEREADABLE ? pszMrHID : pszHID);
|
---|
[26936] | 1492 |
|
---|
| 1493 | /* Keyboard device information */
|
---|
[42551] | 1494 | KeyboardHIDType_T aKeyboardHID;
|
---|
| 1495 | machine->COMGETTER(KeyboardHIDType)(&aKeyboardHID);
|
---|
| 1496 | pszHID = "Unknown";
|
---|
| 1497 | pszMrHID = "unknown";
|
---|
| 1498 | switch (aKeyboardHID)
|
---|
[26936] | 1499 | {
|
---|
[42551] | 1500 | case KeyboardHIDType_None:
|
---|
| 1501 | pszHID = "None";
|
---|
| 1502 | pszMrHID = "none";
|
---|
[26936] | 1503 | break;
|
---|
[42551] | 1504 | case KeyboardHIDType_PS2Keyboard:
|
---|
| 1505 | pszHID = "PS/2 Keyboard";
|
---|
| 1506 | pszMrHID = "ps2kbd";
|
---|
[26936] | 1507 | break;
|
---|
[42551] | 1508 | case KeyboardHIDType_USBKeyboard:
|
---|
| 1509 | pszHID = "USB Keyboard";
|
---|
| 1510 | pszMrHID = "usbkbd";
|
---|
[26936] | 1511 | break;
|
---|
[42551] | 1512 | case KeyboardHIDType_ComboKeyboard:
|
---|
| 1513 | pszHID = "USB and PS/2 Keyboard";
|
---|
| 1514 | pszMrHID = "combokbd";
|
---|
[26936] | 1515 | break;
|
---|
| 1516 | default:
|
---|
| 1517 | break;
|
---|
| 1518 | }
|
---|
[70717] | 1519 | SHOW_UTF8_STRING("hidkeyboard", "Keyboard Device:", details == VMINFO_MACHINEREADABLE ? pszMrHID : pszHID);
|
---|
[26936] | 1520 |
|
---|
[35761] | 1521 | ComPtr<ISystemProperties> sysProps;
|
---|
[53266] | 1522 | pVirtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam());
|
---|
[35761] | 1523 |
|
---|
[40548] | 1524 | /* get the maximum amount of UARTs */
|
---|
[3494] | 1525 | ULONG maxUARTs = 0;
|
---|
[3496] | 1526 | sysProps->COMGETTER(SerialPortCount)(&maxUARTs);
|
---|
[3494] | 1527 | for (ULONG currentUART = 0; currentUART < maxUARTs; currentUART++)
|
---|
| 1528 | {
|
---|
| 1529 | ComPtr<ISerialPort> uart;
|
---|
| 1530 | rc = machine->GetSerialPort(currentUART, uart.asOutParam());
|
---|
| 1531 | if (SUCCEEDED(rc) && uart)
|
---|
| 1532 | {
|
---|
[70717] | 1533 | FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "uart%u" : "UART %u:", currentUART + 1);
|
---|
| 1534 |
|
---|
[40548] | 1535 | /* show the config of this UART */
|
---|
[3494] | 1536 | BOOL fEnabled;
|
---|
| 1537 | uart->COMGETTER(Enabled)(&fEnabled);
|
---|
| 1538 | if (!fEnabled)
|
---|
| 1539 | {
|
---|
[4779] | 1540 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 1541 | RTPrintf("%s=\"off\"\n", szNm);
|
---|
[4779] | 1542 | else
|
---|
[70717] | 1543 | RTPrintf("%-28s disabled\n", szNm);
|
---|
[3494] | 1544 | }
|
---|
| 1545 | else
|
---|
| 1546 | {
|
---|
[4370] | 1547 | ULONG ulIRQ, ulIOBase;
|
---|
[4324] | 1548 | PortMode_T HostMode;
|
---|
[4269] | 1549 | Bstr path;
|
---|
[3494] | 1550 | BOOL fServer;
|
---|
[73768] | 1551 | UartType_T UartType;
|
---|
[4370] | 1552 | uart->COMGETTER(IRQ)(&ulIRQ);
|
---|
| 1553 | uart->COMGETTER(IOBase)(&ulIOBase);
|
---|
[4269] | 1554 | uart->COMGETTER(Path)(path.asOutParam());
|
---|
[3494] | 1555 | uart->COMGETTER(Server)(&fServer);
|
---|
[4274] | 1556 | uart->COMGETTER(HostMode)(&HostMode);
|
---|
[73768] | 1557 | uart->COMGETTER(UartType)(&UartType);
|
---|
[3494] | 1558 |
|
---|
[4779] | 1559 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 1560 | RTPrintf("%s=\"%#06x,%d\"\n", szNm, ulIOBase, ulIRQ);
|
---|
[4779] | 1561 | else
|
---|
[70717] | 1562 | RTPrintf("%-28s I/O base: %#06x, IRQ: %d", szNm, ulIOBase, ulIRQ);
|
---|
[4274] | 1563 | switch (HostMode)
|
---|
[4269] | 1564 | {
|
---|
| 1565 | default:
|
---|
[7207] | 1566 | case PortMode_Disconnected:
|
---|
[4779] | 1567 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1568 | RTPrintf("uartmode%d=\"disconnected\"\n", currentUART + 1);
|
---|
| 1569 | else
|
---|
[73768] | 1570 | RTPrintf(", disconnected");
|
---|
[4269] | 1571 | break;
|
---|
[19624] | 1572 | case PortMode_RawFile:
|
---|
| 1573 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[55259] | 1574 | RTPrintf("uartmode%d=\"file,%ls\"\n", currentUART + 1,
|
---|
[19624] | 1575 | path.raw());
|
---|
| 1576 | else
|
---|
[38735] | 1577 | RTPrintf(", attached to raw file '%ls'\n",
|
---|
[19624] | 1578 | path.raw());
|
---|
| 1579 | break;
|
---|
[55259] | 1580 | case PortMode_TCP:
|
---|
| 1581 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1582 | RTPrintf("uartmode%d=\"%s,%ls\"\n", currentUART + 1,
|
---|
| 1583 | fServer ? "tcpserver" : "tcpclient", path.raw());
|
---|
| 1584 | else
|
---|
[73768] | 1585 | RTPrintf(", attached to tcp (%s) '%ls'",
|
---|
[55259] | 1586 | fServer ? "server" : "client", path.raw());
|
---|
| 1587 | break;
|
---|
[7207] | 1588 | case PortMode_HostPipe:
|
---|
[4779] | 1589 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[38735] | 1590 | RTPrintf("uartmode%d=\"%s,%ls\"\n", currentUART + 1,
|
---|
[4779] | 1591 | fServer ? "server" : "client", path.raw());
|
---|
| 1592 | else
|
---|
[73768] | 1593 | RTPrintf(", attached to pipe (%s) '%ls'",
|
---|
[4779] | 1594 | fServer ? "server" : "client", path.raw());
|
---|
[4269] | 1595 | break;
|
---|
[7207] | 1596 | case PortMode_HostDevice:
|
---|
[4779] | 1597 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[38735] | 1598 | RTPrintf("uartmode%d=\"%ls\"\n", currentUART + 1,
|
---|
[4779] | 1599 | path.raw());
|
---|
| 1600 | else
|
---|
[73768] | 1601 | RTPrintf(", attached to device '%ls'", path.raw());
|
---|
[4269] | 1602 | break;
|
---|
| 1603 | }
|
---|
[73768] | 1604 | switch (UartType)
|
---|
| 1605 | {
|
---|
| 1606 | default:
|
---|
| 1607 | case UartType_U16450:
|
---|
| 1608 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1609 | RTPrintf("uarttype%d=\"16450\"\n", currentUART + 1);
|
---|
| 1610 | else
|
---|
| 1611 | RTPrintf(", 16450\n");
|
---|
| 1612 | break;
|
---|
| 1613 | case UartType_U16550A:
|
---|
| 1614 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1615 | RTPrintf("uarttype%d=\"16550A\"\n", currentUART + 1);
|
---|
| 1616 | else
|
---|
| 1617 | RTPrintf(", 16550A\n");
|
---|
| 1618 | break;
|
---|
| 1619 | case UartType_U16750:
|
---|
| 1620 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1621 | RTPrintf("uarttype%d=\"16750\"\n", currentUART + 1);
|
---|
| 1622 | else
|
---|
| 1623 | RTPrintf(", 16750\n");
|
---|
| 1624 | break;
|
---|
| 1625 | }
|
---|
[3494] | 1626 | }
|
---|
| 1627 | }
|
---|
| 1628 | }
|
---|
| 1629 |
|
---|
[40548] | 1630 | /* get the maximum amount of LPTs */
|
---|
| 1631 | ULONG maxLPTs = 0;
|
---|
| 1632 | sysProps->COMGETTER(ParallelPortCount)(&maxLPTs);
|
---|
| 1633 | for (ULONG currentLPT = 0; currentLPT < maxLPTs; currentLPT++)
|
---|
| 1634 | {
|
---|
| 1635 | ComPtr<IParallelPort> lpt;
|
---|
| 1636 | rc = machine->GetParallelPort(currentLPT, lpt.asOutParam());
|
---|
| 1637 | if (SUCCEEDED(rc) && lpt)
|
---|
| 1638 | {
|
---|
[70717] | 1639 | FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "lpt%u" : "LPT %u:", currentLPT + 1);
|
---|
| 1640 |
|
---|
[40548] | 1641 | /* show the config of this LPT */
|
---|
| 1642 | BOOL fEnabled;
|
---|
| 1643 | lpt->COMGETTER(Enabled)(&fEnabled);
|
---|
| 1644 | if (!fEnabled)
|
---|
| 1645 | {
|
---|
| 1646 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 1647 | RTPrintf("%s=\"off\"\n", szNm);
|
---|
[40548] | 1648 | else
|
---|
[70717] | 1649 | RTPrintf("%-28s disabled\n", szNm);
|
---|
[40548] | 1650 | }
|
---|
| 1651 | else
|
---|
| 1652 | {
|
---|
| 1653 | ULONG ulIRQ, ulIOBase;
|
---|
| 1654 | Bstr path;
|
---|
| 1655 | lpt->COMGETTER(IRQ)(&ulIRQ);
|
---|
| 1656 | lpt->COMGETTER(IOBase)(&ulIOBase);
|
---|
| 1657 | lpt->COMGETTER(Path)(path.asOutParam());
|
---|
| 1658 |
|
---|
| 1659 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 1660 | RTPrintf("%s=\"%#06x,%d\"\n", szNm, ulIOBase, ulIRQ);
|
---|
[40548] | 1661 | else
|
---|
[70717] | 1662 | RTPrintf("%-28s I/O base: %#06x, IRQ: %d", szNm, ulIOBase, ulIRQ);
|
---|
[59269] | 1663 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 1664 | RTPrintf("lptmode%d=\"%ls\"\n", currentLPT + 1, path.raw());
|
---|
[59269] | 1665 | else
|
---|
| 1666 | RTPrintf(", attached to device '%ls'\n", path.raw());
|
---|
[40548] | 1667 | }
|
---|
| 1668 | }
|
---|
| 1669 | }
|
---|
| 1670 |
|
---|
[1] | 1671 | ComPtr<IAudioAdapter> AudioAdapter;
|
---|
| 1672 | rc = machine->COMGETTER(AudioAdapter)(AudioAdapter.asOutParam());
|
---|
| 1673 | if (SUCCEEDED(rc))
|
---|
| 1674 | {
|
---|
[56479] | 1675 | const char *pszDrv = "Unknown";
|
---|
| 1676 | const char *pszCtrl = "Unknown";
|
---|
| 1677 | const char *pszCodec = "Unknown";
|
---|
[1] | 1678 | BOOL fEnabled;
|
---|
| 1679 | rc = AudioAdapter->COMGETTER(Enabled)(&fEnabled);
|
---|
| 1680 | if (SUCCEEDED(rc) && fEnabled)
|
---|
| 1681 | {
|
---|
[6597] | 1682 | AudioDriverType_T enmDrvType;
|
---|
| 1683 | rc = AudioAdapter->COMGETTER(AudioDriver)(&enmDrvType);
|
---|
| 1684 | switch (enmDrvType)
|
---|
[1] | 1685 | {
|
---|
[7207] | 1686 | case AudioDriverType_Null:
|
---|
[4779] | 1687 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[6597] | 1688 | pszDrv = "null";
|
---|
[4779] | 1689 | else
|
---|
[6597] | 1690 | pszDrv = "Null";
|
---|
[4779] | 1691 | break;
|
---|
[7466] | 1692 | case AudioDriverType_WinMM:
|
---|
[4779] | 1693 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[6597] | 1694 | pszDrv = "winmm";
|
---|
[4779] | 1695 | else
|
---|
[6597] | 1696 | pszDrv = "WINMM";
|
---|
[4779] | 1697 | break;
|
---|
[7466] | 1698 | case AudioDriverType_DirectSound:
|
---|
[4779] | 1699 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[6597] | 1700 | pszDrv = "dsound";
|
---|
[4779] | 1701 | else
|
---|
[6597] | 1702 | pszDrv = "DSOUND";
|
---|
[4779] | 1703 | break;
|
---|
[7207] | 1704 | case AudioDriverType_OSS:
|
---|
[4779] | 1705 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[6597] | 1706 | pszDrv = "oss";
|
---|
[4779] | 1707 | else
|
---|
[6597] | 1708 | pszDrv = "OSS";
|
---|
[4779] | 1709 | break;
|
---|
[7207] | 1710 | case AudioDriverType_ALSA:
|
---|
[4779] | 1711 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[6597] | 1712 | pszDrv = "alsa";
|
---|
[4779] | 1713 | else
|
---|
[6597] | 1714 | pszDrv = "ALSA";
|
---|
[4779] | 1715 | break;
|
---|
[7207] | 1716 | case AudioDriverType_Pulse:
|
---|
[6597] | 1717 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1718 | pszDrv = "pulse";
|
---|
| 1719 | else
|
---|
| 1720 | pszDrv = "PulseAudio";
|
---|
| 1721 | break;
|
---|
[7466] | 1722 | case AudioDriverType_CoreAudio:
|
---|
[4779] | 1723 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[6597] | 1724 | pszDrv = "coreaudio";
|
---|
[4779] | 1725 | else
|
---|
[6597] | 1726 | pszDrv = "CoreAudio";
|
---|
[4779] | 1727 | break;
|
---|
[7525] | 1728 | case AudioDriverType_SolAudio:
|
---|
| 1729 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1730 | pszDrv = "solaudio";
|
---|
| 1731 | else
|
---|
| 1732 | pszDrv = "SolAudio";
|
---|
| 1733 | break;
|
---|
[4779] | 1734 | default:
|
---|
| 1735 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[6597] | 1736 | pszDrv = "unknown";
|
---|
[4779] | 1737 | break;
|
---|
[1] | 1738 | }
|
---|
[6597] | 1739 | AudioControllerType_T enmCtrlType;
|
---|
| 1740 | rc = AudioAdapter->COMGETTER(AudioController)(&enmCtrlType);
|
---|
| 1741 | switch (enmCtrlType)
|
---|
| 1742 | {
|
---|
| 1743 | case AudioControllerType_AC97:
|
---|
| 1744 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1745 | pszCtrl = "ac97";
|
---|
| 1746 | else
|
---|
| 1747 | pszCtrl = "AC97";
|
---|
| 1748 | break;
|
---|
| 1749 | case AudioControllerType_SB16:
|
---|
[56486] | 1750 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1751 | pszCtrl = "sb16";
|
---|
| 1752 | else
|
---|
[6597] | 1753 | pszCtrl = "SB16";
|
---|
| 1754 | break;
|
---|
[30976] | 1755 | case AudioControllerType_HDA:
|
---|
| 1756 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1757 | pszCtrl = "hda";
|
---|
| 1758 | else
|
---|
| 1759 | pszCtrl = "HDA";
|
---|
| 1760 | break;
|
---|
[68513] | 1761 | default:
|
---|
| 1762 | break;
|
---|
[6597] | 1763 | }
|
---|
[56479] | 1764 | AudioCodecType_T enmCodecType;
|
---|
| 1765 | rc = AudioAdapter->COMGETTER(AudioCodec)(&enmCodecType);
|
---|
| 1766 | switch (enmCodecType)
|
---|
| 1767 | {
|
---|
| 1768 | case AudioCodecType_SB16:
|
---|
| 1769 | pszCodec = "SB16";
|
---|
| 1770 | break;
|
---|
| 1771 | case AudioCodecType_STAC9700:
|
---|
| 1772 | pszCodec = "STAC9700";
|
---|
| 1773 | break;
|
---|
| 1774 | case AudioCodecType_AD1980:
|
---|
| 1775 | pszCodec = "AD1980";
|
---|
| 1776 | break;
|
---|
| 1777 | case AudioCodecType_STAC9221:
|
---|
| 1778 | pszCodec = "STAC9221";
|
---|
| 1779 | break;
|
---|
[63300] | 1780 | case AudioCodecType_Null: break; /* Shut up MSC. */
|
---|
[68513] | 1781 | default: break;
|
---|
[56479] | 1782 | }
|
---|
[1] | 1783 | }
|
---|
| 1784 | else
|
---|
| 1785 | fEnabled = FALSE;
|
---|
[68513] | 1786 |
|
---|
[4779] | 1787 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 1788 | RTPrintf("audio=\"%s\"\n", fEnabled ? pszDrv : "none");
|
---|
[4779] | 1789 | else
|
---|
[19643] | 1790 | {
|
---|
[70717] | 1791 | RTPrintf("%-28s %s", "Audio:", fEnabled ? "enabled" : "disabled");
|
---|
[19643] | 1792 | if (fEnabled)
|
---|
[70717] | 1793 | RTPrintf(" (Driver: %s, Controller: %s, Codec: %s)", pszDrv, pszCtrl, pszCodec);
|
---|
[19643] | 1794 | RTPrintf("\n");
|
---|
| 1795 | }
|
---|
[70717] | 1796 | SHOW_BOOLEAN_PROP(AudioAdapter, EnabledIn, "audio_in", "Audio playback:");
|
---|
| 1797 | SHOW_BOOLEAN_PROP(AudioAdapter, EnabledOut, "audio_out", "Audio capture:");
|
---|
[1] | 1798 | }
|
---|
| 1799 |
|
---|
[1414] | 1800 | /* Shared clipboard */
|
---|
| 1801 | {
|
---|
[70717] | 1802 | const char *psz;
|
---|
| 1803 | ClipboardMode_T enmMode = (ClipboardMode_T)0;
|
---|
[4779] | 1804 | rc = machine->COMGETTER(ClipboardMode)(&enmMode);
|
---|
| 1805 | switch (enmMode)
|
---|
| 1806 | {
|
---|
[7207] | 1807 | case ClipboardMode_Disabled:
|
---|
[70717] | 1808 | psz = "disabled";
|
---|
[4779] | 1809 | break;
|
---|
[7207] | 1810 | case ClipboardMode_HostToGuest:
|
---|
[70717] | 1811 | psz = details == VMINFO_MACHINEREADABLE ? "hosttoguest" : "HostToGuest";
|
---|
[4779] | 1812 | break;
|
---|
[7207] | 1813 | case ClipboardMode_GuestToHost:
|
---|
[70717] | 1814 | psz = details == VMINFO_MACHINEREADABLE ? "guesttohost" : "GuestToHost";
|
---|
[4779] | 1815 | break;
|
---|
[7207] | 1816 | case ClipboardMode_Bidirectional:
|
---|
[70717] | 1817 | psz = details == VMINFO_MACHINEREADABLE ? "bidirectional" : "Bidirectional";
|
---|
[4779] | 1818 | break;
|
---|
| 1819 | default:
|
---|
[70717] | 1820 | psz = details == VMINFO_MACHINEREADABLE ? "unknown" : "Unknown";
|
---|
[4779] | 1821 | break;
|
---|
| 1822 | }
|
---|
[70717] | 1823 | SHOW_UTF8_STRING("clipboard", "Clipboard Mode:", psz);
|
---|
[1414] | 1824 | }
|
---|
| 1825 |
|
---|
[55180] | 1826 | /* Drag and drop */
|
---|
[42261] | 1827 | {
|
---|
[70717] | 1828 | const char *psz;
|
---|
[51476] | 1829 | DnDMode_T enmMode;
|
---|
| 1830 | rc = machine->COMGETTER(DnDMode)(&enmMode);
|
---|
[42261] | 1831 | switch (enmMode)
|
---|
| 1832 | {
|
---|
[51476] | 1833 | case DnDMode_Disabled:
|
---|
[70717] | 1834 | psz = "disabled";
|
---|
[42261] | 1835 | break;
|
---|
[51476] | 1836 | case DnDMode_HostToGuest:
|
---|
[70717] | 1837 | psz = details == VMINFO_MACHINEREADABLE ? "hosttoguest" : "HostToGuest";
|
---|
[42261] | 1838 | break;
|
---|
[51476] | 1839 | case DnDMode_GuestToHost:
|
---|
[70717] | 1840 | psz = details == VMINFO_MACHINEREADABLE ? "guesttohost" : "GuestToHost";
|
---|
[42261] | 1841 | break;
|
---|
[51476] | 1842 | case DnDMode_Bidirectional:
|
---|
[70717] | 1843 | psz = details == VMINFO_MACHINEREADABLE ? "bidirectional" : "Bidirectional";
|
---|
[42261] | 1844 | break;
|
---|
| 1845 | default:
|
---|
[70717] | 1846 | psz = details == VMINFO_MACHINEREADABLE ? "unknown" : "Unknown";
|
---|
[42261] | 1847 | break;
|
---|
| 1848 | }
|
---|
[70717] | 1849 | SHOW_UTF8_STRING("draganddrop", "Drag and drop Mode:", psz);
|
---|
[42261] | 1850 | }
|
---|
| 1851 |
|
---|
[44948] | 1852 | {
|
---|
| 1853 | SessionState_T sessState;
|
---|
| 1854 | rc = machine->COMGETTER(SessionState)(&sessState);
|
---|
| 1855 | if (SUCCEEDED(rc) && sessState != SessionState_Unlocked)
|
---|
| 1856 | {
|
---|
[55800] | 1857 | Bstr sessName;
|
---|
| 1858 | rc = machine->COMGETTER(SessionName)(sessName.asOutParam());
|
---|
| 1859 | if (SUCCEEDED(rc) && !sessName.isEmpty())
|
---|
[70717] | 1860 | SHOW_BSTR_STRING("SessionName", "Session name:", sessName);
|
---|
[44948] | 1861 | }
|
---|
| 1862 | }
|
---|
| 1863 |
|
---|
[53266] | 1864 | if (pConsole)
|
---|
[1] | 1865 | {
|
---|
[12202] | 1866 | do
|
---|
| 1867 | {
|
---|
[38529] | 1868 | ComPtr<IDisplay> display;
|
---|
[53266] | 1869 | rc = pConsole->COMGETTER(Display)(display.asOutParam());
|
---|
[42628] | 1870 | if (rc == E_ACCESSDENIED || display.isNull())
|
---|
[38529] | 1871 | break; /* VM not powered up */
|
---|
| 1872 | if (FAILED(rc))
|
---|
| 1873 | {
|
---|
[53266] | 1874 | com::GlueHandleComError(pConsole, "COMGETTER(Display)(display.asOutParam())", rc, __FILE__, __LINE__);
|
---|
[38529] | 1875 | return rc;
|
---|
| 1876 | }
|
---|
[12202] | 1877 | ULONG xRes, yRes, bpp;
|
---|
[47774] | 1878 | LONG xOrigin, yOrigin;
|
---|
[52978] | 1879 | GuestMonitorStatus_T monitorStatus;
|
---|
| 1880 | rc = display->GetScreenResolution(0, &xRes, &yRes, &bpp, &xOrigin, &yOrigin, &monitorStatus);
|
---|
[12202] | 1881 | if (rc == E_ACCESSDENIED)
|
---|
| 1882 | break; /* VM not powered up */
|
---|
| 1883 | if (FAILED(rc))
|
---|
| 1884 | {
|
---|
[30681] | 1885 | com::ErrorInfo info(display, COM_IIDOF(IDisplay));
|
---|
[16530] | 1886 | GluePrintErrorInfo(info);
|
---|
[12202] | 1887 | return rc;
|
---|
| 1888 | }
|
---|
| 1889 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[52978] | 1890 | RTPrintf("VideoMode=\"%d,%d,%d\"@%d,%d %d\n", xRes, yRes, bpp, xOrigin, yOrigin, monitorStatus);
|
---|
[12202] | 1891 | else
|
---|
[52978] | 1892 | {
|
---|
| 1893 | const char *pszMonitorStatus = "unknown status";
|
---|
| 1894 | switch (monitorStatus)
|
---|
| 1895 | {
|
---|
[64104] | 1896 | case GuestMonitorStatus_Blank: pszMonitorStatus = "blank"; break;
|
---|
[52978] | 1897 | case GuestMonitorStatus_Enabled: pszMonitorStatus = "enabled"; break;
|
---|
| 1898 | case GuestMonitorStatus_Disabled: pszMonitorStatus = "disabled"; break;
|
---|
| 1899 | default: break;
|
---|
| 1900 | }
|
---|
[70717] | 1901 | RTPrintf("%-28s %dx%dx%d at %d,%d %s\n", "Video mode:", xRes, yRes, bpp, xOrigin, yOrigin, pszMonitorStatus);
|
---|
[52978] | 1902 | }
|
---|
[12202] | 1903 | }
|
---|
| 1904 | while (0);
|
---|
[1] | 1905 | }
|
---|
| 1906 |
|
---|
| 1907 | /*
|
---|
[33386] | 1908 | * Remote Desktop
|
---|
[1] | 1909 | */
|
---|
[33386] | 1910 | ComPtr<IVRDEServer> vrdeServer;
|
---|
| 1911 | rc = machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
| 1912 | if (SUCCEEDED(rc) && vrdeServer)
|
---|
[1] | 1913 | {
|
---|
| 1914 | BOOL fEnabled = false;
|
---|
[33386] | 1915 | vrdeServer->COMGETTER(Enabled)(&fEnabled);
|
---|
[1] | 1916 | if (fEnabled)
|
---|
| 1917 | {
|
---|
[33386] | 1918 | LONG currentPort = -1;
|
---|
[23643] | 1919 | Bstr ports;
|
---|
[33386] | 1920 | vrdeServer->GetVRDEProperty(Bstr("TCP/Ports").raw(), ports.asOutParam());
|
---|
[4779] | 1921 | Bstr address;
|
---|
[33386] | 1922 | vrdeServer->GetVRDEProperty(Bstr("TCP/Address").raw(), address.asOutParam());
|
---|
[4779] | 1923 | BOOL fMultiCon;
|
---|
[33386] | 1924 | vrdeServer->COMGETTER(AllowMultiConnection)(&fMultiCon);
|
---|
[12126] | 1925 | BOOL fReuseCon;
|
---|
[33386] | 1926 | vrdeServer->COMGETTER(ReuseSingleConnection)(&fReuseCon);
|
---|
[35146] | 1927 | Bstr videoChannel;
|
---|
| 1928 | vrdeServer->GetVRDEProperty(Bstr("VideoChannel/Enabled").raw(), videoChannel.asOutParam());
|
---|
| 1929 | BOOL fVideoChannel = (videoChannel.compare(Bstr("true"), Bstr::CaseInsensitive)== 0)
|
---|
| 1930 | || (videoChannel == "1");
|
---|
| 1931 | Bstr videoChannelQuality;
|
---|
| 1932 | vrdeServer->GetVRDEProperty(Bstr("VideoChannel/Quality").raw(), videoChannelQuality.asOutParam());
|
---|
[70790] | 1933 | AuthType_T authType = (AuthType_T)0;
|
---|
[2333] | 1934 | const char *strAuthType;
|
---|
[33386] | 1935 | vrdeServer->COMGETTER(AuthType)(&authType);
|
---|
| 1936 | switch (authType)
|
---|
[1] | 1937 | {
|
---|
[33386] | 1938 | case AuthType_Null:
|
---|
[1] | 1939 | strAuthType = "null";
|
---|
| 1940 | break;
|
---|
[33386] | 1941 | case AuthType_External:
|
---|
[1] | 1942 | strAuthType = "external";
|
---|
| 1943 | break;
|
---|
[33386] | 1944 | case AuthType_Guest:
|
---|
[1] | 1945 | strAuthType = "guest";
|
---|
| 1946 | break;
|
---|
| 1947 | default:
|
---|
| 1948 | strAuthType = "unknown";
|
---|
| 1949 | break;
|
---|
| 1950 | }
|
---|
[53266] | 1951 | if (pConsole)
|
---|
[23643] | 1952 | {
|
---|
[33386] | 1953 | ComPtr<IVRDEServerInfo> vrdeServerInfo;
|
---|
[53266] | 1954 | CHECK_ERROR_RET(pConsole, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);
|
---|
[42672] | 1955 | if (!vrdeServerInfo.isNull())
|
---|
[23643] | 1956 | {
|
---|
[42672] | 1957 | rc = vrdeServerInfo->COMGETTER(Port)(¤tPort);
|
---|
| 1958 | if (rc == E_ACCESSDENIED)
|
---|
| 1959 | {
|
---|
| 1960 | currentPort = -1; /* VM not powered up */
|
---|
| 1961 | }
|
---|
[52037] | 1962 | else if (FAILED(rc))
|
---|
[42672] | 1963 | {
|
---|
| 1964 | com::ErrorInfo info(vrdeServerInfo, COM_IIDOF(IVRDEServerInfo));
|
---|
| 1965 | GluePrintErrorInfo(info);
|
---|
| 1966 | return rc;
|
---|
| 1967 | }
|
---|
[23643] | 1968 | }
|
---|
| 1969 | }
|
---|
[4779] | 1970 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 1971 | {
|
---|
[33386] | 1972 | RTPrintf("vrde=\"on\"\n");
|
---|
| 1973 | RTPrintf("vrdeport=%d\n", currentPort);
|
---|
[38735] | 1974 | RTPrintf("vrdeports=\"%ls\"\n", ports.raw());
|
---|
| 1975 | RTPrintf("vrdeaddress=\"%ls\"\n", address.raw());
|
---|
[33386] | 1976 | RTPrintf("vrdeauthtype=\"%s\"\n", strAuthType);
|
---|
| 1977 | RTPrintf("vrdemulticon=\"%s\"\n", fMultiCon ? "on" : "off");
|
---|
| 1978 | RTPrintf("vrdereusecon=\"%s\"\n", fReuseCon ? "on" : "off");
|
---|
| 1979 | RTPrintf("vrdevideochannel=\"%s\"\n", fVideoChannel ? "on" : "off");
|
---|
[28836] | 1980 | if (fVideoChannel)
|
---|
[38735] | 1981 | RTPrintf("vrdevideochannelquality=\"%ls\"\n", videoChannelQuality.raw());
|
---|
[4779] | 1982 | }
|
---|
| 1983 | else
|
---|
[4797] | 1984 | {
|
---|
| 1985 | if (address.isEmpty())
|
---|
| 1986 | address = "0.0.0.0";
|
---|
[70717] | 1987 | RTPrintf("%-28s enabled (Address %ls, Ports %ls, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n",
|
---|
| 1988 | "VRDE:", address.raw(), ports.raw(), fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType);
|
---|
[53266] | 1989 | if (pConsole && currentPort != -1 && currentPort != 0)
|
---|
[70717] | 1990 | RTPrintf("%-28s %d\n", "VRDE port:", currentPort);
|
---|
[28836] | 1991 | if (fVideoChannel)
|
---|
[70717] | 1992 | RTPrintf("%-28s enabled (Quality %ls)\n", "Video redirection:", videoChannelQuality.raw());
|
---|
[28836] | 1993 | else
|
---|
[70717] | 1994 | RTPrintf("%-28s disabled\n", "Video redirection:");
|
---|
[4797] | 1995 | }
|
---|
[35105] | 1996 | com::SafeArray<BSTR> aProperties;
|
---|
| 1997 | if (SUCCEEDED(vrdeServer->COMGETTER(VRDEProperties)(ComSafeArrayAsOutParam(aProperties))))
|
---|
| 1998 | {
|
---|
| 1999 | unsigned i;
|
---|
| 2000 | for (i = 0; i < aProperties.size(); ++i)
|
---|
| 2001 | {
|
---|
| 2002 | Bstr value;
|
---|
| 2003 | vrdeServer->GetVRDEProperty(aProperties[i], value.asOutParam());
|
---|
| 2004 | if (details == VMINFO_MACHINEREADABLE)
|
---|
| 2005 | {
|
---|
| 2006 | if (value.isEmpty())
|
---|
[38735] | 2007 | RTPrintf("vrdeproperty[%ls]=<not set>\n", aProperties[i]);
|
---|
[35105] | 2008 | else
|
---|
[38735] | 2009 | RTPrintf("vrdeproperty[%ls]=\"%ls\"\n", aProperties[i], value.raw());
|
---|
[35105] | 2010 | }
|
---|
| 2011 | else
|
---|
| 2012 | {
|
---|
| 2013 | if (value.isEmpty())
|
---|
[70717] | 2014 | RTPrintf("%-28s: %-10lS = <not set>\n", "VRDE property", aProperties[i]);
|
---|
[35105] | 2015 | else
|
---|
[70717] | 2016 | RTPrintf("%-28s: %-10lS = \"%ls\"\n", "VRDE property", aProperties[i], value.raw());
|
---|
[35105] | 2017 | }
|
---|
| 2018 | }
|
---|
| 2019 | }
|
---|
[1] | 2020 | }
|
---|
| 2021 | else
|
---|
[4779] | 2022 | {
|
---|
| 2023 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[33386] | 2024 | RTPrintf("vrde=\"off\"\n");
|
---|
[4779] | 2025 | else
|
---|
[70717] | 2026 | RTPrintf("%-28s disabled\n", "VRDE:");
|
---|
[4779] | 2027 | }
|
---|
[1] | 2028 | }
|
---|
| 2029 |
|
---|
| 2030 | /*
|
---|
| 2031 | * USB.
|
---|
| 2032 | */
|
---|
[47401] | 2033 | SafeIfaceArray<IUSBController> USBCtlColl;
|
---|
| 2034 | rc = machine->COMGETTER(USBControllers)(ComSafeArrayAsOutParam(USBCtlColl));
|
---|
[1] | 2035 | if (SUCCEEDED(rc))
|
---|
| 2036 | {
|
---|
[47401] | 2037 | bool fOhciEnabled = false;
|
---|
| 2038 | bool fEhciEnabled = false;
|
---|
[50721] | 2039 | bool fXhciEnabled = false;
|
---|
[47401] | 2040 |
|
---|
| 2041 | for (unsigned i = 0; i < USBCtlColl.size(); i++)
|
---|
| 2042 | {
|
---|
| 2043 | USBControllerType_T enmType;
|
---|
| 2044 |
|
---|
| 2045 | rc = USBCtlColl[i]->COMGETTER(Type)(&enmType);
|
---|
| 2046 | if (SUCCEEDED(rc))
|
---|
| 2047 | {
|
---|
| 2048 | switch (enmType)
|
---|
| 2049 | {
|
---|
| 2050 | case USBControllerType_OHCI:
|
---|
| 2051 | fOhciEnabled = true;
|
---|
| 2052 | break;
|
---|
| 2053 | case USBControllerType_EHCI:
|
---|
| 2054 | fEhciEnabled = true;
|
---|
| 2055 | break;
|
---|
[50721] | 2056 | case USBControllerType_XHCI:
|
---|
| 2057 | fXhciEnabled = true;
|
---|
| 2058 | break;
|
---|
[47401] | 2059 | default:
|
---|
| 2060 | break;
|
---|
| 2061 | }
|
---|
| 2062 | }
|
---|
| 2063 | }
|
---|
| 2064 |
|
---|
[70717] | 2065 | SHOW_BOOL_VALUE("usb", "OHCI USB:", fOhciEnabled);
|
---|
| 2066 | SHOW_BOOL_VALUE("ehci", "EHCI USB:", fEhciEnabled);
|
---|
| 2067 | SHOW_BOOL_VALUE("xhci", "xHCI USB:", fXhciEnabled);
|
---|
[47376] | 2068 | }
|
---|
[38555] | 2069 |
|
---|
[47376] | 2070 | ComPtr<IUSBDeviceFilters> USBFlts;
|
---|
| 2071 | rc = machine->COMGETTER(USBDeviceFilters)(USBFlts.asOutParam());
|
---|
| 2072 | if (SUCCEEDED(rc))
|
---|
| 2073 | {
|
---|
[26951] | 2074 | SafeIfaceArray <IUSBDeviceFilter> Coll;
|
---|
[47376] | 2075 | rc = USBFlts->COMGETTER(DeviceFilters)(ComSafeArrayAsOutParam(Coll));
|
---|
[26951] | 2076 | if (SUCCEEDED(rc))
|
---|
| 2077 | {
|
---|
[59269] | 2078 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2079 | RTPrintf("\nUSB Device Filters:\n\n");
|
---|
[1] | 2080 |
|
---|
[26951] | 2081 | if (Coll.size() == 0)
|
---|
[17336] | 2082 | {
|
---|
[26951] | 2083 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2084 | RTPrintf("<none>\n\n");
|
---|
| 2085 | }
|
---|
| 2086 | else
|
---|
| 2087 | {
|
---|
| 2088 | for (size_t index = 0; index < Coll.size(); ++index)
|
---|
| 2089 | {
|
---|
| 2090 | ComPtr<IUSBDeviceFilter> DevPtr = Coll[index];
|
---|
[1] | 2091 |
|
---|
[26951] | 2092 | if (details != VMINFO_MACHINEREADABLE)
|
---|
[70717] | 2093 | SHOW_UTF8_STRING("index", "Index:", FmtNm(szNm, "%zu", index));
|
---|
| 2094 | SHOW_BOOLEAN_PROP_EX(DevPtr, Active, FmtNm(szNm, "USBFilterActive%zu", index + 1), "Active:", "yes", "no");
|
---|
| 2095 | SHOW_STRING_PROP(DevPtr, Name, FmtNm(szNm, "USBFilterName%zu", index + 1), "Name:");
|
---|
| 2096 | SHOW_STRING_PROP(DevPtr, VendorId, FmtNm(szNm, "USBFilterVendorId%zu", index + 1), "VendorId:");
|
---|
| 2097 | SHOW_STRING_PROP(DevPtr, ProductId, FmtNm(szNm, "USBFilterProductId%zu", index + 1), "ProductId:");
|
---|
| 2098 | SHOW_STRING_PROP(DevPtr, Revision, FmtNm(szNm, "USBFilterRevision%zu", index + 1), "Revision:");
|
---|
| 2099 | SHOW_STRING_PROP(DevPtr, Manufacturer, FmtNm(szNm, "USBFilterManufacturer%zu", index + 1), "Manufacturer:");
|
---|
| 2100 | SHOW_STRING_PROP(DevPtr, Product, FmtNm(szNm, "USBFilterProduct%zu", index + 1), "Product:");
|
---|
| 2101 | SHOW_STRING_PROP(DevPtr, Remote, FmtNm(szNm, "USBFilterRemote%zu", index + 1), "Remote:");
|
---|
| 2102 | SHOW_STRING_PROP(DevPtr, SerialNumber, FmtNm(szNm, "USBFilterSerialNumber%zu", index + 1), "Serial Number:");
|
---|
[26951] | 2103 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2104 | {
|
---|
| 2105 | ULONG fMaskedIfs;
|
---|
[32718] | 2106 | CHECK_ERROR_RET(DevPtr, COMGETTER(MaskedInterfaces)(&fMaskedIfs), rc);
|
---|
[26951] | 2107 | if (fMaskedIfs)
|
---|
[70717] | 2108 | RTPrintf("%-28s %#010x\n", "Masked Interfaces:", fMaskedIfs);
|
---|
[26951] | 2109 | RTPrintf("\n");
|
---|
| 2110 | }
|
---|
[17336] | 2111 | }
|
---|
[5713] | 2112 | }
|
---|
[1] | 2113 | }
|
---|
| 2114 |
|
---|
[53266] | 2115 | if (pConsole)
|
---|
[1] | 2116 | {
|
---|
| 2117 | /* scope */
|
---|
| 2118 | {
|
---|
[4779] | 2119 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2120 | RTPrintf("Available remote USB devices:\n\n");
|
---|
[1] | 2121 |
|
---|
[17684] | 2122 | SafeIfaceArray <IHostUSBDevice> coll;
|
---|
[53266] | 2123 | CHECK_ERROR_RET(pConsole, COMGETTER(RemoteUSBDevices)(ComSafeArrayAsOutParam(coll)), rc);
|
---|
[1] | 2124 |
|
---|
[17684] | 2125 | if (coll.size() == 0)
|
---|
[1] | 2126 | {
|
---|
[4779] | 2127 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2128 | RTPrintf("<none>\n\n");
|
---|
[1] | 2129 | }
|
---|
| 2130 | else
|
---|
| 2131 | {
|
---|
[70717] | 2132 | /* This code is duplicated below, with USBAttach as prefix. */
|
---|
| 2133 | const char *pszPfx = "USBRemote";
|
---|
| 2134 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
[17684] | 2135 | {
|
---|
[70717] | 2136 | ComPtr<IHostUSBDevice> dev = coll[i];
|
---|
[1] | 2137 |
|
---|
[70717] | 2138 | SHOW_STRING_PROP(dev, Id, FmtNm(szNm, "%sActive%zu", pszPfx, i + 1), "UUID:");
|
---|
| 2139 | SHOW_USHORT_PROP_EX2(dev, VendorId, FmtNm(szNm, "%sVendorId%zu", pszPfx, i + 1), "VendorId:", "", "%#06x", "%#06x (%04X)");
|
---|
| 2140 | SHOW_USHORT_PROP_EX2(dev, ProductId, FmtNm(szNm, "%sProductId%zu", pszPfx, i + 1), "ProductId:", "", "%#06x", "%#06x (%04X)");
|
---|
| 2141 |
|
---|
[17684] | 2142 | USHORT bcdRevision;
|
---|
[32718] | 2143 | CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), rc);
|
---|
[4779] | 2144 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 2145 | RTStrPrintf(szValue, sizeof(szValue), "%#04x%02x", bcdRevision >> 8, bcdRevision & 0xff);
|
---|
[4779] | 2146 | else
|
---|
[70717] | 2147 | RTStrPrintf(szValue, sizeof(szValue), "%u.%u (%02u%02u)\n",
|
---|
| 2148 | bcdRevision >> 8, bcdRevision & 0xff, bcdRevision >> 8, bcdRevision & 0xff);
|
---|
| 2149 | SHOW_UTF8_STRING(FmtNm(szNm, "%sRevision%zu", pszPfx, i + 1), "Revision:", szValue);
|
---|
[1] | 2150 |
|
---|
[70717] | 2151 | SHOW_STRING_PROP_NOT_EMPTY(dev, Manufacturer, FmtNm(szNm, "%sManufacturer%zu", pszPfx, i + 1), "Manufacturer:");
|
---|
| 2152 | SHOW_STRING_PROP_NOT_EMPTY(dev, Product, FmtNm(szNm, "%sProduct%zu", pszPfx, i + 1), "Product:");
|
---|
| 2153 | SHOW_STRING_PROP_NOT_EMPTY(dev, SerialNumber, FmtNm(szNm, "%sSerialNumber%zu", pszPfx, i + 1), "SerialNumber:");
|
---|
| 2154 | SHOW_STRING_PROP_NOT_EMPTY(dev, Address, FmtNm(szNm, "%sAddress%zu", pszPfx, i + 1), "Address:");
|
---|
[1] | 2155 |
|
---|
[17684] | 2156 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2157 | RTPrintf("\n");
|
---|
| 2158 | }
|
---|
[1] | 2159 | }
|
---|
| 2160 | }
|
---|
| 2161 |
|
---|
| 2162 | /* scope */
|
---|
| 2163 | {
|
---|
[4779] | 2164 | if (details != VMINFO_MACHINEREADABLE)
|
---|
[32718] | 2165 | RTPrintf("Currently Attached USB Devices:\n\n");
|
---|
[1] | 2166 |
|
---|
[17553] | 2167 | SafeIfaceArray <IUSBDevice> coll;
|
---|
[53266] | 2168 | CHECK_ERROR_RET(pConsole, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)), rc);
|
---|
[1] | 2169 |
|
---|
[17553] | 2170 | if (coll.size() == 0)
|
---|
[1] | 2171 | {
|
---|
[4779] | 2172 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2173 | RTPrintf("<none>\n\n");
|
---|
[1] | 2174 | }
|
---|
| 2175 | else
|
---|
| 2176 | {
|
---|
[70717] | 2177 | /* This code is duplicated below, with USBAttach as prefix. */
|
---|
| 2178 | const char *pszPfx = "USBAttach";
|
---|
| 2179 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
[17553] | 2180 | {
|
---|
[77162] | 2181 | ComPtr<IUSBDevice> dev = coll[i];
|
---|
[1] | 2182 |
|
---|
[70717] | 2183 | SHOW_STRING_PROP(dev, Id, FmtNm(szNm, "%sActive%zu", pszPfx, i + 1), "UUID:");
|
---|
| 2184 | SHOW_USHORT_PROP_EX2(dev, VendorId, FmtNm(szNm, "%sVendorId%zu", pszPfx, i + 1), "VendorId:", "", "%#06x", "%#06x (%04X)");
|
---|
| 2185 | SHOW_USHORT_PROP_EX2(dev, ProductId, FmtNm(szNm, "%sProductId%zu", pszPfx, i + 1), "ProductId:", "", "%#06x", "%#06x (%04X)");
|
---|
| 2186 |
|
---|
[17553] | 2187 | USHORT bcdRevision;
|
---|
[32718] | 2188 | CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), rc);
|
---|
[4779] | 2189 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[70717] | 2190 | RTStrPrintf(szValue, sizeof(szValue), "%#04x%02x", bcdRevision >> 8, bcdRevision & 0xff);
|
---|
[4779] | 2191 | else
|
---|
[70717] | 2192 | RTStrPrintf(szValue, sizeof(szValue), "%u.%u (%02u%02u)\n",
|
---|
| 2193 | bcdRevision >> 8, bcdRevision & 0xff, bcdRevision >> 8, bcdRevision & 0xff);
|
---|
| 2194 | SHOW_UTF8_STRING(FmtNm(szNm, "%sRevision%zu", pszPfx, i + 1), "Revision:", szValue);
|
---|
[1] | 2195 |
|
---|
[70717] | 2196 | SHOW_STRING_PROP_NOT_EMPTY(dev, Manufacturer, FmtNm(szNm, "%sManufacturer%zu", pszPfx, i + 1), "Manufacturer:");
|
---|
| 2197 | SHOW_STRING_PROP_NOT_EMPTY(dev, Product, FmtNm(szNm, "%sProduct%zu", pszPfx, i + 1), "Product:");
|
---|
| 2198 | SHOW_STRING_PROP_NOT_EMPTY(dev, SerialNumber, FmtNm(szNm, "%sSerialNumber%zu", pszPfx, i + 1), "SerialNumber:");
|
---|
| 2199 | SHOW_STRING_PROP_NOT_EMPTY(dev, Address, FmtNm(szNm, "%sAddress%zu", pszPfx, i + 1), "Address:");
|
---|
[1] | 2200 |
|
---|
[17553] | 2201 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2202 | RTPrintf("\n");
|
---|
| 2203 | }
|
---|
[1] | 2204 | }
|
---|
| 2205 | }
|
---|
| 2206 | }
|
---|
| 2207 | } /* USB */
|
---|
| 2208 |
|
---|
[36630] | 2209 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
| 2210 | /* Host PCI passthrough devices */
|
---|
| 2211 | {
|
---|
[42551] | 2212 | SafeIfaceArray <IPCIDeviceAttachment> assignments;
|
---|
| 2213 | rc = machine->COMGETTER(PCIDeviceAssignments)(ComSafeArrayAsOutParam(assignments));
|
---|
[36630] | 2214 | if (SUCCEEDED(rc))
|
---|
| 2215 | {
|
---|
| 2216 | if (assignments.size() > 0 && (details != VMINFO_MACHINEREADABLE))
|
---|
| 2217 | {
|
---|
| 2218 | RTPrintf("\nAttached physical PCI devices:\n\n");
|
---|
| 2219 | }
|
---|
[37200] | 2220 |
|
---|
[36630] | 2221 | for (size_t index = 0; index < assignments.size(); ++index)
|
---|
| 2222 | {
|
---|
[42551] | 2223 | ComPtr<IPCIDeviceAttachment> Assignment = assignments[index];
|
---|
| 2224 | char szHostPCIAddress[32], szGuestPCIAddress[32];
|
---|
| 2225 | LONG iHostPCIAddress = -1, iGuestPCIAddress = -1;
|
---|
[36630] | 2226 | Bstr DevName;
|
---|
| 2227 |
|
---|
| 2228 | Assignment->COMGETTER(Name)(DevName.asOutParam());
|
---|
[42551] | 2229 | Assignment->COMGETTER(HostAddress)(&iHostPCIAddress);
|
---|
| 2230 | Assignment->COMGETTER(GuestAddress)(&iGuestPCIAddress);
|
---|
| 2231 | PCIBusAddress().fromLong(iHostPCIAddress).format(szHostPCIAddress, sizeof(szHostPCIAddress));
|
---|
| 2232 | PCIBusAddress().fromLong(iGuestPCIAddress).format(szGuestPCIAddress, sizeof(szGuestPCIAddress));
|
---|
[36630] | 2233 |
|
---|
| 2234 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[42551] | 2235 | RTPrintf("AttachedHostPCI=%s,%s\n", szHostPCIAddress, szGuestPCIAddress);
|
---|
[36630] | 2236 | else
|
---|
[42551] | 2237 | RTPrintf(" Host device %ls at %s attached as %s\n", DevName.raw(), szHostPCIAddress, szGuestPCIAddress);
|
---|
[36630] | 2238 | }
|
---|
[37200] | 2239 |
|
---|
[36630] | 2240 | if (assignments.size() > 0 && (details != VMINFO_MACHINEREADABLE))
|
---|
| 2241 | {
|
---|
| 2242 | RTPrintf("\n");
|
---|
| 2243 | }
|
---|
| 2244 | }
|
---|
| 2245 | }
|
---|
| 2246 | /* Host PCI passthrough devices */
|
---|
| 2247 | #endif
|
---|
| 2248 |
|
---|
[1] | 2249 | /*
|
---|
[40469] | 2250 | * Bandwidth groups
|
---|
| 2251 | */
|
---|
| 2252 | if (details != VMINFO_MACHINEREADABLE)
|
---|
[41584] | 2253 | RTPrintf("Bandwidth groups: ");
|
---|
[40469] | 2254 | {
|
---|
| 2255 | ComPtr<IBandwidthControl> bwCtrl;
|
---|
| 2256 | CHECK_ERROR_RET(machine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()), rc);
|
---|
| 2257 |
|
---|
[40470] | 2258 | rc = showBandwidthGroups(bwCtrl, details);
|
---|
[40469] | 2259 | }
|
---|
| 2260 |
|
---|
| 2261 |
|
---|
| 2262 | /*
|
---|
[1] | 2263 | * Shared folders
|
---|
| 2264 | */
|
---|
[4779] | 2265 | if (details != VMINFO_MACHINEREADABLE)
|
---|
[70717] | 2266 | RTPrintf("Shared folders:");
|
---|
[1] | 2267 | uint32_t numSharedFolders = 0;
|
---|
| 2268 | #if 0 // not yet implemented
|
---|
| 2269 | /* globally shared folders first */
|
---|
| 2270 | {
|
---|
[17739] | 2271 | SafeIfaceArray <ISharedFolder> sfColl;
|
---|
[53266] | 2272 | CHECK_ERROR_RET(pVirtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(sfColl)), rc);
|
---|
[17739] | 2273 | for (size_t i = 0; i < sfColl.size(); ++i)
|
---|
[1] | 2274 | {
|
---|
[17739] | 2275 | ComPtr<ISharedFolder> sf = sfColl[i];
|
---|
[75380] | 2276 | showSharedFolder(sf, details, "global mapping", "GlobalMapping", i + 1, numSharedFolders == 0);
|
---|
[1] | 2277 | ++numSharedFolders;
|
---|
| 2278 | }
|
---|
| 2279 | }
|
---|
| 2280 | #endif
|
---|
| 2281 | /* now VM mappings */
|
---|
| 2282 | {
|
---|
[16966] | 2283 | com::SafeIfaceArray <ISharedFolder> folders;
|
---|
| 2284 | CHECK_ERROR_RET(machine, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);
|
---|
| 2285 | for (size_t i = 0; i < folders.size(); ++i)
|
---|
[1] | 2286 | {
|
---|
[47908] | 2287 | ComPtr<ISharedFolder> sf = folders[i];
|
---|
[75380] | 2288 | showSharedFolder(sf, details, "machine mapping", "MachineMapping", i + 1, numSharedFolders == 0);
|
---|
[1] | 2289 | ++numSharedFolders;
|
---|
| 2290 | }
|
---|
| 2291 | }
|
---|
| 2292 | /* transient mappings */
|
---|
[53266] | 2293 | if (pConsole)
|
---|
[1] | 2294 | {
|
---|
[16966] | 2295 | com::SafeIfaceArray <ISharedFolder> folders;
|
---|
[53266] | 2296 | CHECK_ERROR_RET(pConsole, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);
|
---|
[16966] | 2297 | for (size_t i = 0; i < folders.size(); ++i)
|
---|
[1] | 2298 | {
|
---|
[47908] | 2299 | ComPtr<ISharedFolder> sf = folders[i];
|
---|
[75380] | 2300 | showSharedFolder(sf, details, "transient mapping", "TransientMapping", i + 1, numSharedFolders == 0);
|
---|
[1] | 2301 | ++numSharedFolders;
|
---|
| 2302 | }
|
---|
| 2303 | }
|
---|
[4779] | 2304 | if (!numSharedFolders && details != VMINFO_MACHINEREADABLE)
|
---|
[1] | 2305 | RTPrintf("<none>\n");
|
---|
[4779] | 2306 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2307 | RTPrintf("\n");
|
---|
[1] | 2308 |
|
---|
[53266] | 2309 | if (pConsole)
|
---|
[1] | 2310 | {
|
---|
| 2311 | /*
|
---|
[33386] | 2312 | * Live VRDE info.
|
---|
[1] | 2313 | */
|
---|
[33386] | 2314 | ComPtr<IVRDEServerInfo> vrdeServerInfo;
|
---|
[53266] | 2315 | CHECK_ERROR_RET(pConsole, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);
|
---|
[70717] | 2316 | BOOL fActive = FALSE;
|
---|
| 2317 | ULONG cNumberOfClients = 0;
|
---|
[42628] | 2318 | LONG64 BeginTime = 0;
|
---|
| 2319 | LONG64 EndTime = 0;
|
---|
| 2320 | LONG64 BytesSent = 0;
|
---|
| 2321 | LONG64 BytesSentTotal = 0;
|
---|
| 2322 | LONG64 BytesReceived = 0;
|
---|
| 2323 | LONG64 BytesReceivedTotal = 0;
|
---|
[1] | 2324 | Bstr User;
|
---|
| 2325 | Bstr Domain;
|
---|
| 2326 | Bstr ClientName;
|
---|
| 2327 | Bstr ClientIP;
|
---|
[42628] | 2328 | ULONG ClientVersion = 0;
|
---|
| 2329 | ULONG EncryptionStyle = 0;
|
---|
[1] | 2330 |
|
---|
[42628] | 2331 | if (!vrdeServerInfo.isNull())
|
---|
| 2332 | {
|
---|
[70717] | 2333 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(Active)(&fActive), rc);
|
---|
| 2334 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(NumberOfClients)(&cNumberOfClients), rc);
|
---|
[42628] | 2335 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(BeginTime)(&BeginTime), rc);
|
---|
| 2336 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(EndTime)(&EndTime), rc);
|
---|
| 2337 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(BytesSent)(&BytesSent), rc);
|
---|
| 2338 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(BytesSentTotal)(&BytesSentTotal), rc);
|
---|
| 2339 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(BytesReceived)(&BytesReceived), rc);
|
---|
| 2340 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(BytesReceivedTotal)(&BytesReceivedTotal), rc);
|
---|
| 2341 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(User)(User.asOutParam()), rc);
|
---|
| 2342 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(Domain)(Domain.asOutParam()), rc);
|
---|
| 2343 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(ClientName)(ClientName.asOutParam()), rc);
|
---|
| 2344 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(ClientIP)(ClientIP.asOutParam()), rc);
|
---|
| 2345 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(ClientVersion)(&ClientVersion), rc);
|
---|
| 2346 | CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(EncryptionStyle)(&EncryptionStyle), rc);
|
---|
| 2347 | }
|
---|
[1] | 2348 |
|
---|
[70717] | 2349 | SHOW_BOOL_VALUE_EX("VRDEActiveConnection", "VRDE Connection:", fActive, "active", "not active");
|
---|
| 2350 | SHOW_ULONG_VALUE("VRDEClients=", "Clients so far:", cNumberOfClients, "");
|
---|
[1] | 2351 |
|
---|
[70717] | 2352 | if (cNumberOfClients > 0)
|
---|
[1] | 2353 | {
|
---|
[70717] | 2354 | char szTimeValue[128];
|
---|
| 2355 | makeTimeStr(szTimeValue, sizeof(szTimeValue), BeginTime);
|
---|
| 2356 | if (fActive)
|
---|
| 2357 | SHOW_UTF8_STRING("VRDEStartTime", "Start time:", szTimeValue);
|
---|
[1] | 2358 | else
|
---|
| 2359 | {
|
---|
[70717] | 2360 | SHOW_UTF8_STRING("VRDELastStartTime", "Last started:", szTimeValue);
|
---|
| 2361 | makeTimeStr(szTimeValue, sizeof(szTimeValue), EndTime);
|
---|
| 2362 | SHOW_UTF8_STRING("VRDELastEndTime", "Last ended:", szTimeValue);
|
---|
[1] | 2363 | }
|
---|
| 2364 |
|
---|
[31698] | 2365 | int64_t ThroughputSend = 0;
|
---|
| 2366 | int64_t ThroughputReceive = 0;
|
---|
[13587] | 2367 | if (EndTime != BeginTime)
|
---|
| 2368 | {
|
---|
| 2369 | ThroughputSend = (BytesSent * 1000) / (EndTime - BeginTime);
|
---|
| 2370 | ThroughputReceive = (BytesReceived * 1000) / (EndTime - BeginTime);
|
---|
| 2371 | }
|
---|
[70717] | 2372 | SHOW_LONG64_VALUE("VRDEBytesSent", "Sent:", BytesSent, "Bytes");
|
---|
| 2373 | SHOW_LONG64_VALUE("VRDEThroughputSend", "Average speed:", ThroughputSend, "B/s");
|
---|
| 2374 | SHOW_LONG64_VALUE("VRDEBytesSentTotal", "Sent total:", BytesSentTotal, "Bytes");
|
---|
[13587] | 2375 |
|
---|
[70717] | 2376 | SHOW_LONG64_VALUE("VRDEBytesReceived", "Received:", BytesReceived, "Bytes");
|
---|
| 2377 | SHOW_LONG64_VALUE("VRDEThroughputReceive", "Speed:", ThroughputReceive, "B/s");
|
---|
| 2378 | SHOW_LONG64_VALUE("VRDEBytesReceivedTotal", "Received total:", BytesReceivedTotal, "Bytes");
|
---|
[1] | 2379 |
|
---|
[70717] | 2380 | if (fActive)
|
---|
[4779] | 2381 | {
|
---|
[70717] | 2382 | SHOW_BSTR_STRING("VRDEUserName", "User name:", User);
|
---|
| 2383 | SHOW_BSTR_STRING("VRDEDomain", "Domain:", Domain);
|
---|
| 2384 | SHOW_BSTR_STRING("VRDEClientName", "Client name:", ClientName);
|
---|
| 2385 | SHOW_BSTR_STRING("VRDEClientIP", "Client IP:", ClientIP);
|
---|
| 2386 | SHOW_ULONG_VALUE("VRDEClientVersion", "Client version:", ClientVersion, "");
|
---|
| 2387 | SHOW_UTF8_STRING("VRDEEncryption", "Encryption:", EncryptionStyle == 0 ? "RDP4" : "RDP5 (X.509)");
|
---|
[4779] | 2388 | }
|
---|
[1] | 2389 | }
|
---|
| 2390 |
|
---|
[4779] | 2391 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2392 | RTPrintf("\n");
|
---|
[1] | 2393 | }
|
---|
| 2394 |
|
---|
[75345] | 2395 | #ifdef VBOX_WITH_RECORDING
|
---|
[45835] | 2396 | {
|
---|
| 2397 | /* Video capture */
|
---|
[68941] | 2398 | BOOL fCaptureVideo = FALSE;
|
---|
[75345] | 2399 | # ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
[68941] | 2400 | BOOL fCaptureAudio = FALSE;
|
---|
| 2401 | # endif
|
---|
| 2402 |
|
---|
[75361] | 2403 | ComPtr<IRecordingSettings> recordingSettings;
|
---|
| 2404 | CHECK_ERROR_RET(machine, COMGETTER(RecordingSettings)(recordingSettings.asOutParam()), rc);
|
---|
[75251] | 2405 |
|
---|
[75361] | 2406 | SafeIfaceArray <IRecordingScreenSettings> saRecordingScreenScreens;
|
---|
| 2407 | CHECK_ERROR_RET(recordingSettings, COMGETTER(Screens)(ComSafeArrayAsOutParam(saRecordingScreenScreens)), rc);
|
---|
[75251] | 2408 |
|
---|
| 2409 | /* For now all screens have the same configuration; so take screen 0 and work with that. */
|
---|
| 2410 | ULONG fFeatures;
|
---|
[75361] | 2411 | CHECK_ERROR_RET(saRecordingScreenScreens[0], COMGETTER(Features)(&fFeatures), rc);
|
---|
[45835] | 2412 | ULONG Width;
|
---|
[75361] | 2413 | CHECK_ERROR_RET(saRecordingScreenScreens[0], COMGETTER(VideoWidth)(&Width), rc);
|
---|
[45835] | 2414 | ULONG Height;
|
---|
[75361] | 2415 | CHECK_ERROR_RET(saRecordingScreenScreens[0], COMGETTER(VideoHeight)(&Height), rc);
|
---|
[45838] | 2416 | ULONG Rate;
|
---|
[75361] | 2417 | CHECK_ERROR_RET(saRecordingScreenScreens[0], COMGETTER(VideoRate)(&Rate), rc);
|
---|
[45926] | 2418 | ULONG Fps;
|
---|
[75361] | 2419 | CHECK_ERROR_RET(saRecordingScreenScreens[0], COMGETTER(VideoFPS)(&Fps), rc);
|
---|
[68941] | 2420 | Bstr bstrFile;
|
---|
[75926] | 2421 | CHECK_ERROR_RET(saRecordingScreenScreens[0], COMGETTER(Filename)(bstrFile.asOutParam()), rc);
|
---|
[68941] | 2422 | Bstr bstrOptions;
|
---|
[75361] | 2423 | CHECK_ERROR_RET(saRecordingScreenScreens[0], COMGETTER(Options)(bstrOptions.asOutParam()), rc);
|
---|
[68941] | 2424 |
|
---|
| 2425 | Utf8Str strOptions(bstrOptions);
|
---|
| 2426 | size_t pos = 0;
|
---|
| 2427 | com::Utf8Str key, value;
|
---|
| 2428 | while ((pos = strOptions.parseKeyValue(key, value, pos)) != com::Utf8Str::npos)
|
---|
| 2429 | {
|
---|
| 2430 | if (key.compare("vc_enabled", Utf8Str::CaseInsensitive) == 0)
|
---|
| 2431 | {
|
---|
| 2432 | fCaptureVideo = value.compare("true", Utf8Str::CaseInsensitive) == 0;
|
---|
| 2433 | }
|
---|
| 2434 | else if (key.compare("ac_enabled", Utf8Str::CaseInsensitive) == 0)
|
---|
| 2435 | {
|
---|
[75345] | 2436 | # ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
[68941] | 2437 | fCaptureAudio = value.compare("true", Utf8Str::CaseInsensitive) == 0;
|
---|
| 2438 | # endif
|
---|
| 2439 | }
|
---|
| 2440 | }
|
---|
| 2441 |
|
---|
[70717] | 2442 | SHOW_BOOL_VALUE_EX("videocap", "Capturing:", fCaptureVideo, "active", "not active");
|
---|
[75345] | 2443 | # ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
[70717] | 2444 | SHOW_BOOL_VALUE_EX("videocapaudio", "Capture audio:", fCaptureAudio, "active", "not active");
|
---|
[68941] | 2445 | # endif
|
---|
[70717] | 2446 | szValue[0] = '\0';
|
---|
[75361] | 2447 | for (size_t i = 0, off = 0; i < saRecordingScreenScreens.size(); i++)
|
---|
[75251] | 2448 | {
|
---|
| 2449 | BOOL fEnabled;
|
---|
[75361] | 2450 | CHECK_ERROR_RET(saRecordingScreenScreens[i], COMGETTER(Enabled)(&fEnabled), rc);
|
---|
[75251] | 2451 | if (fEnabled && off < sizeof(szValue) - 3)
|
---|
[70717] | 2452 | off += RTStrPrintf(&szValue[off], sizeof(szValue) - off, off ? ",%zu" : "%zu", i);
|
---|
[75251] | 2453 | }
|
---|
| 2454 | SHOW_UTF8_STRING("capturescreens", "Capture screens:", szValue);
|
---|
| 2455 | SHOW_BSTR_STRING("capturefilename", "Capture file:", bstrFile);
|
---|
[70717] | 2456 | RTStrPrintf(szValue, sizeof(szValue), "%ux%u", Width, Height);
|
---|
[75251] | 2457 | SHOW_UTF8_STRING("captureres", "Capture dimensions:", szValue);
|
---|
| 2458 | SHOW_ULONG_VALUE("capturevideorate", "Capture rate:", Rate, "kbps");
|
---|
| 2459 | SHOW_ULONG_VALUE("capturevideofps", "Capture FPS:", Fps, "kbps");
|
---|
| 2460 | SHOW_BSTR_STRING("captureopts", "Capture options:", bstrOptions);
|
---|
[70717] | 2461 |
|
---|
| 2462 | if (details != VMINFO_MACHINEREADABLE)
|
---|
[46123] | 2463 | RTPrintf("\n");
|
---|
[70717] | 2464 | /** @todo Add more audio capturing profile / information here. */
|
---|
[45835] | 2465 | }
|
---|
[75345] | 2466 | #endif /* VBOX_WITH_RECORDING */
|
---|
[45835] | 2467 |
|
---|
[4779] | 2468 | if ( details == VMINFO_STANDARD
|
---|
| 2469 | || details == VMINFO_FULL
|
---|
| 2470 | || details == VMINFO_MACHINEREADABLE)
|
---|
[1259] | 2471 | {
|
---|
| 2472 | Bstr description;
|
---|
| 2473 | machine->COMGETTER(Description)(description.asOutParam());
|
---|
| 2474 | if (!description.isEmpty())
|
---|
| 2475 | {
|
---|
[4779] | 2476 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[65826] | 2477 | outputMachineReadableString("description", &description);
|
---|
[4779] | 2478 | else
|
---|
[38735] | 2479 | RTPrintf("Description:\n%ls\n", description.raw());
|
---|
[1259] | 2480 | }
|
---|
| 2481 | }
|
---|
[4657] | 2482 |
|
---|
[4779] | 2483 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2484 | RTPrintf("Guest:\n\n");
|
---|
[4657] | 2485 |
|
---|
[70717] | 2486 | SHOW_ULONG_PROP(machine, MemoryBalloonSize, "GuestMemoryBalloon", "Configured memory balloon size:", "MB");
|
---|
[35887] | 2487 |
|
---|
[53266] | 2488 | if (pConsole)
|
---|
[30734] | 2489 | {
|
---|
[30740] | 2490 | ComPtr<IGuest> guest;
|
---|
[53266] | 2491 | rc = pConsole->COMGETTER(Guest)(guest.asOutParam());
|
---|
[42628] | 2492 | if (SUCCEEDED(rc) && !guest.isNull())
|
---|
[30734] | 2493 | {
|
---|
[70717] | 2494 | SHOW_STRING_PROP_NOT_EMPTY(guest, OSTypeId, "GuestOSType", "OS type:");
|
---|
[30734] | 2495 |
|
---|
[32086] | 2496 | AdditionsRunLevelType_T guestRunLevel; /** @todo Add a runlevel-to-string (e.g. 0 = "None") method? */
|
---|
[32020] | 2497 | rc = guest->COMGETTER(AdditionsRunLevel)(&guestRunLevel);
|
---|
[30734] | 2498 | if (SUCCEEDED(rc))
|
---|
[70717] | 2499 | SHOW_ULONG_VALUE("GuestAdditionsRunLevel", "Additions run level:", (ULONG)guestRunLevel, "");
|
---|
[30740] | 2500 |
|
---|
[70717] | 2501 | Bstr guestString;
|
---|
[35967] | 2502 | rc = guest->COMGETTER(AdditionsVersion)(guestString.asOutParam());
|
---|
| 2503 | if ( SUCCEEDED(rc)
|
---|
| 2504 | && !guestString.isEmpty())
|
---|
[30740] | 2505 | {
|
---|
[39882] | 2506 | ULONG uRevision;
|
---|
| 2507 | rc = guest->COMGETTER(AdditionsRevision)(&uRevision);
|
---|
| 2508 | if (FAILED(rc))
|
---|
| 2509 | uRevision = 0;
|
---|
[70717] | 2510 | RTStrPrintf(szValue, sizeof(szValue), "%ls r%u", guestString.raw(), uRevision);
|
---|
| 2511 | SHOW_UTF8_STRING("GuestAdditionsVersion", "Additions version", szValue);
|
---|
[35967] | 2512 | }
|
---|
[35887] | 2513 |
|
---|
[35967] | 2514 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2515 | RTPrintf("\nGuest Facilities:\n\n");
|
---|
[35887] | 2516 |
|
---|
[35967] | 2517 | /* Print information about known Guest Additions facilities: */
|
---|
| 2518 | SafeIfaceArray <IAdditionsFacility> collFac;
|
---|
| 2519 | CHECK_ERROR_RET(guest, COMGETTER(Facilities)(ComSafeArrayAsOutParam(collFac)), rc);
|
---|
| 2520 | LONG64 lLastUpdatedMS;
|
---|
| 2521 | char szLastUpdated[32];
|
---|
| 2522 | AdditionsFacilityStatus_T curStatus;
|
---|
| 2523 | for (size_t index = 0; index < collFac.size(); ++index)
|
---|
| 2524 | {
|
---|
| 2525 | ComPtr<IAdditionsFacility> fac = collFac[index];
|
---|
| 2526 | if (fac)
|
---|
[35887] | 2527 | {
|
---|
[35967] | 2528 | CHECK_ERROR_RET(fac, COMGETTER(Name)(guestString.asOutParam()), rc);
|
---|
| 2529 | if (!guestString.isEmpty())
|
---|
| 2530 | {
|
---|
| 2531 | CHECK_ERROR_RET(fac, COMGETTER(Status)(&curStatus), rc);
|
---|
| 2532 | CHECK_ERROR_RET(fac, COMGETTER(LastUpdated)(&lLastUpdatedMS), rc);
|
---|
| 2533 | if (details == VMINFO_MACHINEREADABLE)
|
---|
[38735] | 2534 | RTPrintf("GuestAdditionsFacility_%ls=%u,%lld\n",
|
---|
[35967] | 2535 | guestString.raw(), curStatus, lLastUpdatedMS);
|
---|
| 2536 | else
|
---|
| 2537 | {
|
---|
| 2538 | makeTimeStr(szLastUpdated, sizeof(szLastUpdated), lLastUpdatedMS);
|
---|
[38735] | 2539 | RTPrintf("Facility \"%ls\": %s (last update: %s)\n",
|
---|
[35967] | 2540 | guestString.raw(), facilityStateToName(curStatus, false /* No short naming */), szLastUpdated);
|
---|
| 2541 | }
|
---|
| 2542 | }
|
---|
[35887] | 2543 | else
|
---|
[35967] | 2544 | AssertMsgFailed(("Facility with undefined name retrieved!\n"));
|
---|
[35887] | 2545 | }
|
---|
[35967] | 2546 | else
|
---|
| 2547 | AssertMsgFailed(("Invalid facility returned!\n"));
|
---|
[30740] | 2548 | }
|
---|
[35967] | 2549 | if (!collFac.size() && details != VMINFO_MACHINEREADABLE)
|
---|
| 2550 | RTPrintf("No active facilities.\n");
|
---|
[30734] | 2551 | }
|
---|
| 2552 | }
|
---|
| 2553 |
|
---|
[26294] | 2554 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2555 | RTPrintf("\n");
|
---|
[4657] | 2556 |
|
---|
[1] | 2557 | /*
|
---|
| 2558 | * snapshots
|
---|
| 2559 | */
|
---|
| 2560 | ComPtr<ISnapshot> snapshot;
|
---|
[33300] | 2561 | rc = machine->FindSnapshot(Bstr().raw(), snapshot.asOutParam());
|
---|
[1] | 2562 | if (SUCCEEDED(rc) && snapshot)
|
---|
| 2563 | {
|
---|
[23882] | 2564 | ComPtr<ISnapshot> currentSnapshot;
|
---|
[23884] | 2565 | rc = machine->COMGETTER(CurrentSnapshot)(currentSnapshot.asOutParam());
|
---|
[23882] | 2566 | if (SUCCEEDED(rc))
|
---|
| 2567 | {
|
---|
| 2568 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2569 | RTPrintf("Snapshots:\n\n");
|
---|
| 2570 | showSnapshots(snapshot, currentSnapshot, details);
|
---|
| 2571 | }
|
---|
[1] | 2572 | }
|
---|
| 2573 |
|
---|
[4779] | 2574 | if (details != VMINFO_MACHINEREADABLE)
|
---|
| 2575 | RTPrintf("\n");
|
---|
[1] | 2576 | return S_OK;
|
---|
| 2577 | }
|
---|
| 2578 |
|
---|
[14613] | 2579 | #if defined(_MSC_VER)
|
---|
| 2580 | # pragma optimize("", on)
|
---|
[63300] | 2581 | # pragma warning(pop)
|
---|
[14613] | 2582 | #endif
|
---|
| 2583 |
|
---|
[18773] | 2584 | static const RTGETOPTDEF g_aShowVMInfoOptions[] =
|
---|
| 2585 | {
|
---|
| 2586 | { "--details", 'D', RTGETOPT_REQ_NOTHING },
|
---|
| 2587 | { "-details", 'D', RTGETOPT_REQ_NOTHING }, // deprecated
|
---|
| 2588 | { "--machinereadable", 'M', RTGETOPT_REQ_NOTHING },
|
---|
| 2589 | { "-machinereadable", 'M', RTGETOPT_REQ_NOTHING }, // deprecated
|
---|
[28192] | 2590 | { "--log", 'l', RTGETOPT_REQ_UINT32 },
|
---|
[18773] | 2591 | };
|
---|
| 2592 |
|
---|
[56118] | 2593 | RTEXITCODE handleShowVMInfo(HandlerArg *a)
|
---|
[1] | 2594 | {
|
---|
| 2595 | HRESULT rc;
|
---|
[18773] | 2596 | const char *VMNameOrUuid = NULL;
|
---|
[28192] | 2597 | bool fLog = false;
|
---|
[28348] | 2598 | uint32_t uLogIdx = 0;
|
---|
[18773] | 2599 | bool fDetails = false;
|
---|
| 2600 | bool fMachinereadable = false;
|
---|
[1] | 2601 |
|
---|
[18773] | 2602 | int c;
|
---|
| 2603 | RTGETOPTUNION ValueUnion;
|
---|
| 2604 | RTGETOPTSTATE GetState;
|
---|
| 2605 | // start at 0 because main() has hacked both the argc and argv given to us
|
---|
[26517] | 2606 | RTGetOptInit(&GetState, a->argc, a->argv, g_aShowVMInfoOptions, RT_ELEMENTS(g_aShowVMInfoOptions),
|
---|
| 2607 | 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
[18773] | 2608 | while ((c = RTGetOpt(&GetState, &ValueUnion)))
|
---|
| 2609 | {
|
---|
| 2610 | switch (c)
|
---|
| 2611 | {
|
---|
[18774] | 2612 | case 'D': // --details
|
---|
[18773] | 2613 | fDetails = true;
|
---|
| 2614 | break;
|
---|
[1] | 2615 |
|
---|
[18773] | 2616 | case 'M': // --machinereadable
|
---|
| 2617 | fMachinereadable = true;
|
---|
| 2618 | break;
|
---|
| 2619 |
|
---|
[28192] | 2620 | case 'l': // --log
|
---|
| 2621 | fLog = true;
|
---|
| 2622 | uLogIdx = ValueUnion.u32;
|
---|
| 2623 | break;
|
---|
| 2624 |
|
---|
[18773] | 2625 | case VINF_GETOPT_NOT_OPTION:
|
---|
| 2626 | if (!VMNameOrUuid)
|
---|
| 2627 | VMNameOrUuid = ValueUnion.psz;
|
---|
| 2628 | else
|
---|
| 2629 | return errorSyntax(USAGE_SHOWVMINFO, "Invalid parameter '%s'", ValueUnion.psz);
|
---|
| 2630 | break;
|
---|
| 2631 |
|
---|
| 2632 | default:
|
---|
[56118] | 2633 | return errorGetOpt(USAGE_SHOWVMINFO, c, &ValueUnion);
|
---|
[18773] | 2634 | }
|
---|
| 2635 | }
|
---|
| 2636 |
|
---|
| 2637 | /* check for required options */
|
---|
| 2638 | if (!VMNameOrUuid)
|
---|
| 2639 | return errorSyntax(USAGE_SHOWVMINFO, "VM name or UUID required");
|
---|
| 2640 |
|
---|
[1] | 2641 | /* try to find the given machine */
|
---|
[47908] | 2642 | ComPtr<IMachine> machine;
|
---|
[33294] | 2643 | CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMNameOrUuid).raw(),
|
---|
| 2644 | machine.asOutParam()));
|
---|
[28211] | 2645 | if (FAILED(rc))
|
---|
[56118] | 2646 | return RTEXITCODE_FAILURE;
|
---|
[1] | 2647 |
|
---|
[28192] | 2648 | /* Printing the log is exclusive. */
|
---|
| 2649 | if (fLog && (fMachinereadable || fDetails))
|
---|
| 2650 | return errorSyntax(USAGE_SHOWVMINFO, "Option --log is exclusive");
|
---|
| 2651 |
|
---|
| 2652 | if (fLog)
|
---|
| 2653 | {
|
---|
| 2654 | ULONG64 uOffset = 0;
|
---|
| 2655 | SafeArray<BYTE> aLogData;
|
---|
[53266] | 2656 | size_t cbLogData;
|
---|
[28192] | 2657 | while (true)
|
---|
| 2658 | {
|
---|
[28269] | 2659 | /* Reset the array */
|
---|
| 2660 | aLogData.setNull();
|
---|
| 2661 | /* Fetch a chunk of the log file */
|
---|
[28192] | 2662 | CHECK_ERROR_BREAK(machine, ReadLog(uLogIdx, uOffset, _1M,
|
---|
| 2663 | ComSafeArrayAsOutParam(aLogData)));
|
---|
| 2664 | cbLogData = aLogData.size();
|
---|
| 2665 | if (cbLogData == 0)
|
---|
| 2666 | break;
|
---|
| 2667 | /* aLogData has a platform dependent line ending, standardize on
|
---|
| 2668 | * Unix style, as RTStrmWrite does the LF -> CR/LF replacement on
|
---|
| 2669 | * Windows. Otherwise we end up with CR/CR/LF on Windows. */
|
---|
[53266] | 2670 | size_t cbLogDataPrint = cbLogData;
|
---|
[28192] | 2671 | for (BYTE *s = aLogData.raw(), *d = s;
|
---|
| 2672 | s - aLogData.raw() < (ssize_t)cbLogData;
|
---|
| 2673 | s++, d++)
|
---|
| 2674 | {
|
---|
| 2675 | if (*s == '\r')
|
---|
| 2676 | {
|
---|
| 2677 | /* skip over CR, adjust destination */
|
---|
| 2678 | d--;
|
---|
| 2679 | cbLogDataPrint--;
|
---|
| 2680 | }
|
---|
| 2681 | else if (s != d)
|
---|
| 2682 | *d = *s;
|
---|
| 2683 | }
|
---|
| 2684 | RTStrmWrite(g_pStdOut, aLogData.raw(), cbLogDataPrint);
|
---|
| 2685 | uOffset += cbLogData;
|
---|
| 2686 | }
|
---|
| 2687 | }
|
---|
[4779] | 2688 | else
|
---|
[28192] | 2689 | {
|
---|
| 2690 | /* 2nd option can be -details or -argdump */
|
---|
| 2691 | VMINFO_DETAILS details = VMINFO_NONE;
|
---|
| 2692 | if (fMachinereadable)
|
---|
| 2693 | details = VMINFO_MACHINEREADABLE;
|
---|
| 2694 | else if (fDetails)
|
---|
| 2695 | details = VMINFO_FULL;
|
---|
| 2696 | else
|
---|
| 2697 | details = VMINFO_STANDARD;
|
---|
[1259] | 2698 |
|
---|
[28192] | 2699 | /* open an existing session for the VM */
|
---|
[31019] | 2700 | rc = machine->LockMachine(a->session, LockType_Shared);
|
---|
[28192] | 2701 | if (SUCCEEDED(rc))
|
---|
| 2702 | /* get the session machine */
|
---|
| 2703 | rc = a->session->COMGETTER(Machine)(machine.asOutParam());
|
---|
[1] | 2704 |
|
---|
[53266] | 2705 | rc = showVMInfo(a->virtualBox, machine, a->session, details);
|
---|
[1] | 2706 |
|
---|
[53266] | 2707 | a->session->UnlockMachine();
|
---|
[28192] | 2708 | }
|
---|
[1] | 2709 |
|
---|
[56118] | 2710 | return SUCCEEDED(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
|
---|
[1] | 2711 | }
|
---|
| 2712 |
|
---|
[14611] | 2713 | #endif /* !VBOX_ONLY_DOCS */
|
---|
[17336] | 2714 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|