VirtualBox

Changeset 70717 in vbox


Ignore:
Timestamp:
Jan 23, 2018 6:54:16 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120461
Message:

VBoxManage/showvminfo: Cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r70587 r70717  
    221221 *
    222222 * @param   pszName             The variable name.
     223 * @param   pszValue            The value.
     224 */
     225static void outputMachineReadableString(const char *pszName, const char *pszValue)
     226{
     227    Assert(strpbrk(pszName, "\"\\") == NULL);
     228
     229    if (   !pszValue
     230        || !*pszValue
     231        || (   strchr(pszValue, '"') == NULL
     232            && strchr(pszValue, '\\') == NULL) )
     233        RTPrintf("%s=\"%s\"\n", pszName, pszValue);
     234    else
     235    {
     236        /* The value needs escaping. */
     237        RTPrintf("%s=\"", pszName);
     238        const char *psz = pszValue;
     239        for (;;)
     240        {
     241            const char *pszNext = strpbrk(psz, "\"\\");
     242            if (!pszNext)
     243            {
     244                RTPrintf("%s", psz);
     245                break;
     246            }
     247            RTPrintf("%.*s\\%c", pszNext - psz, psz, *pszNext);
     248            psz = pszNext + 1;
     249        }
     250        RTPrintf("\"\n");
     251    }
     252}
     253
     254
     255/**
     256 * This takes care of escaping double quotes and slashes that the string might
     257 * contain.
     258 *
     259 * @param   pszName             The variable name.
    223260 * @param   pbstrValue          The value.
    224261 */
    225262static void outputMachineReadableString(const char *pszName, Bstr const *pbstrValue)
    226263{
    227     Assert(strpbrk(pszName, "\"\\") == NULL);
    228 
    229264    com::Utf8Str strValue(*pbstrValue);
    230     if (    strValue.isEmpty()
    231         || (   !strValue.count('"')
    232             && !strValue.count('\\')))
    233         RTPrintf("%s=\"%s\"\n", pszName, strValue.c_str());
    234     else
    235     {
    236         /* The value needs escaping. */
    237         RTPrintf("%s=\"", pszName);
    238         const char *psz = strValue.c_str();
    239         for (;;)
    240         {
    241             const char *pszNext = strpbrk(psz, "\"\\");
    242             if (!pszNext)
    243             {
    244                 RTPrintf("%s", psz);
    245                 break;
    246             }
    247             RTPrintf("%.*s\\%c", pszNext - psz, psz, *pszNext);
    248             psz = pszNext + 1;
    249         }
    250         RTPrintf("\"\n");
    251     }
     265    outputMachineReadableString(pszName, strValue.c_str());
    252266}
    253267
     
    392406}
    393407
     408/**
     409 * Helper for formatting an indexed name or some such thing.
     410 */
     411static const char *FmtNm(char psz[80], const char *pszFormat, ...)
     412{
     413    va_list va;
     414    va_start(va, pszFormat);
     415    RTStrPrintfV(psz, 80, pszFormat, va);
     416    va_end(va);
     417    return psz;
     418}
     419
    394420
    395421/* Disable global optimizations for MSC 8.0/64 to make it compile in reasonable
     
    415441        pSession->COMGETTER(Console)(pConsole.asOutParam());
    416442
    417 #define SHOW_BOOLEAN_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
    418     SHOW_BOOLEAN_PROP_EX(a_pObj, a_Prop, a_szMachine, a_szHuman, "on", "off")
    419 
    420 #define SHOW_BOOLEAN_PROP_EX(a_pObj, a_Prop, a_szMachine, a_szHuman, a_szTrue, a_szFalse) \
     443    char szNm[80];
     444    char szValue[256];
     445
     446#define SHOW_UTF8_STRING(a_pszMachine, a_pszHuman, a_szValue) \
     447    do \
     448    { \
     449        Assert(a_pszHuman[strlen(a_pszHuman) - 1] == ':'); \
     450        if (details == VMINFO_MACHINEREADABLE) \
     451            outputMachineReadableString(a_pszMachine, a_szValue); \
     452        else \
     453            RTPrintf("%-28s %s\n", a_pszHuman, a_szValue); \
     454    } while (0)
     455
     456#define SHOW_BSTR_STRING(a_pszMachine, a_pszHuman, a_bstrValue) \
     457    do \
     458    { \
     459        Assert(a_pszHuman[strlen(a_pszHuman) - 1] == ':'); \
     460        if (details == VMINFO_MACHINEREADABLE) \
     461            outputMachineReadableString(a_pszMachine, &a_bstrValue); \
     462        else \
     463            RTPrintf("%-28s %ls\n", a_pszHuman, a_bstrValue.raw()); \
     464    } while (0)
     465
     466#define SHOW_BOOL_VALUE_EX(a_pszMachine, a_pszHuman, a_fValue, a_szTrue, a_szFalse) \
     467    do \
     468    { \
     469        if (details == VMINFO_MACHINEREADABLE) \
     470            outputMachineReadableString(a_pszMachine, a_fValue ? "on" : "off"); \
     471        else \
     472            RTPrintf("%-28s %s\n", a_pszHuman, a_fValue ? a_szTrue: a_szFalse); \
     473    } while (0)
     474
     475#define SHOW_BOOL_VALUE(a_pszMachine, a_pszHuman, a_fValue) \
     476    SHOW_BOOL_VALUE_EX(a_pszMachine, a_pszHuman, a_fValue, "enabled", "disabled")
     477
     478#define SHOW_ULONG_VALUE(a_pszMachine, a_pszHuman, a_uValue, a_pszUnit) \
     479    do \
     480    { \
     481        if (details == VMINFO_MACHINEREADABLE) \
     482            RTPrintf("%s=%u\n", a_pszMachine, a_uValue); \
     483        else \
     484            RTPrintf("%-28s %u%s\n", a_pszHuman, a_uValue, a_pszUnit); \
     485    } while (0)
     486
     487#define SHOW_LONG64_VALUE(a_pszMachine, a_pszHuman, a_llValue, a_pszUnit) \
     488    do \
     489    { \
     490        if (details == VMINFO_MACHINEREADABLE) \
     491            RTPrintf("%s=%lld\n", a_pszMachine, a_llValue); \
     492        else \
     493            RTPrintf("%-28s %lld%s\n", a_pszHuman, a_llValue, a_pszUnit); \
     494    } while (0)
     495
     496#define SHOW_BOOLEAN_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
     497    SHOW_BOOLEAN_PROP_EX(a_pObj, a_Prop, a_pszMachine, a_pszHuman, "enabled", "disabled")
     498
     499#define SHOW_BOOLEAN_PROP_EX(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_szTrue, a_szFalse) \
    421500    do \
    422501    { \
     
    424503        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&f), hrcCheck); \
    425504        if (details == VMINFO_MACHINEREADABLE) \
    426             RTPrintf( a_szMachine "=\"%s\"\n", f ? "on" : "off"); \
     505            outputMachineReadableString(a_pszMachine, f ? "on" : "off"); \
    427506        else \
    428             RTPrintf("%-16s %s\n", a_szHuman ":", f ? a_szTrue : a_szFalse); \
     507            RTPrintf("%-28s %s\n", a_pszHuman, f ? a_szTrue : a_szFalse); \
    429508    } while (0)
    430509
    431 #define SHOW_BOOLEAN_METHOD(a_pObj, a_Invocation, a_szMachine, a_szHuman) \
     510#define SHOW_BOOLEAN_METHOD(a_pObj, a_Invocation, a_pszMachine, a_pszHuman) \
    432511    do \
    433512    { \
     
    435514        CHECK_ERROR2I_RET(a_pObj, a_Invocation, hrcCheck); \
    436515        if (details == VMINFO_MACHINEREADABLE) \
    437             RTPrintf( a_szMachine "=\"%s\"\n", f ? "on" : "off"); \
     516            outputMachineReadableString(a_pszMachine, f ? "on" : "off"); \
    438517        else \
    439             RTPrintf("%-16s %s\n", a_szHuman ":", f ? "on" : "off"); \
     518            RTPrintf("%-28s %s\n", a_pszHuman, f ? "enabled" : "disabled"); \
    440519    } while (0)
    441520
    442 #define SHOW_STRING_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
     521#define SHOW_STRING_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
    443522    do \
    444523    { \
     
    446525        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
    447526        if (details == VMINFO_MACHINEREADABLE) \
    448             outputMachineReadableString(a_szMachine, &bstr); \
     527            outputMachineReadableString(a_pszMachine, &bstr); \
    449528        else \
    450             RTPrintf("%-16s %ls\n", a_szHuman ":", bstr.raw()); \
     529            RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \
    451530    } while (0)
    452531
    453     /** @def SHOW_STRING_PROP_MAJ
    454      * For not breaking the output in a dot release we don't show default values. */
    455 #define SHOW_STRING_PROP_MAJ(a_pObj, a_Prop, a_szMachine, a_szHuman, a_szUnless, a_uMajorVer) \
     532#define SHOW_STRING_PROP_NOT_EMPTY(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
    456533    do \
    457534    { \
    458535        Bstr bstr; \
    459536        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
    460         if ((a_uMajorVer) <= VBOX_VERSION_MAJOR || !bstr.equals(a_szUnless)) \
     537        if (bstr.isNotEmpty()) \
     538        { \
     539            if (details == VMINFO_MACHINEREADABLE) \
     540                outputMachineReadableString(a_pszMachine, &bstr); \
     541            else \
     542                RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \
     543        } \
     544    } while (0)
     545
     546    /** @def SHOW_STRING_PROP_MAJ
     547     * For not breaking the output in a dot release we don't show default values. */
     548#define SHOW_STRING_PROP_MAJ(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_pszUnless, a_uMajorVer) \
     549    do \
     550    { \
     551        Bstr bstr; \
     552        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
     553        if ((a_uMajorVer) <= VBOX_VERSION_MAJOR || !bstr.equals(a_pszUnless)) \
    461554        { \
    462555            if (details == VMINFO_MACHINEREADABLE)\
    463                 outputMachineReadableString(a_szMachine, &bstr); \
     556                outputMachineReadableString(a_pszMachine, &bstr); \
    464557            else \
    465                 RTPrintf("%-16s %ls\n", a_szHuman ":", bstr.raw()); \
     558                RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \
    466559        } \
    467560    } while (0)
    468561
    469 #define SHOW_STRINGARRAY_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
     562#define SHOW_STRINGARRAY_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
    470563    do \
    471564    { \
     
    481574        Bstr bstr(str); \
    482575        if (details == VMINFO_MACHINEREADABLE) \
    483             outputMachineReadableString(a_szMachine, &bstr); \
     576            outputMachineReadableString(a_pszMachine, &bstr); \
    484577        else \
    485             RTPrintf("%-16s %ls\n", a_szHuman ":", bstr.raw()); \
     578            RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \
    486579    } while (0)
    487580
    488 #define SHOW_UUID_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
    489     SHOW_STRING_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman)
    490 
    491 #define SHOW_ULONG_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman, a_szUnit) \
     581#define SHOW_UUID_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman) \
     582    SHOW_STRING_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman)
     583
     584#define SHOW_USHORT_PROP_EX2(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_pszUnit, a_szFmtMachine, a_szFmtHuman) \
    492585    do \
    493586    { \
    494         ULONG u32; \
     587        USHORT u16 = 0; \
     588        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&u16), hrcCheck); \
     589        if (details == VMINFO_MACHINEREADABLE) \
     590            RTPrintf("%s=" a_szFmtMachine "\n", a_pszMachine, u16); \
     591        else \
     592            RTPrintf("%-28s " a_szFmtHuman "%s\n", a_pszHuman, u16, u16, a_pszUnit); \
     593    } while (0)
     594
     595#define SHOW_ULONG_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_pszUnit) \
     596    do \
     597    { \
     598        ULONG u32 = 0; \
    495599        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&u32), hrcCheck); \
    496600        if (details == VMINFO_MACHINEREADABLE) \
    497             RTPrintf(a_szMachine "=%u\n", u32); \
     601            RTPrintf("%s=%u\n", a_pszMachine, u32); \
    498602        else \
    499             RTPrintf("%-16s %u" a_szUnit "\n", a_szHuman ":", u32); \
     603            RTPrintf("%-28s %u%s\n", a_pszHuman, u32, a_pszUnit); \
    500604    } while (0)
    501605
    502 #define SHOW_LONG64_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman, a_szUnit) \
     606#define SHOW_LONG64_PROP(a_pObj, a_Prop, a_pszMachine, a_pszHuman, a_pszUnit) \
    503607    do \
    504608    { \
    505         LONG64 i64; \
     609        LONG64 i64 = 0; \
    506610        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&i64), hrcCheck); \
    507611        if (details == VMINFO_MACHINEREADABLE) \
    508             RTPrintf(a_szMachine "=%lld\n", i64); \
     612            RTPrintf("%s=%lld\n", a_pszMachine, i64); \
    509613        else \
    510             RTPrintf("%-16s %'lld" a_szUnit "\n", a_szHuman ":", i64); \
     614            RTPrintf("%-28s %'lld%s\n", a_pszHuman, i64, a_pszUnit); \
    511615    } while (0)
    512616
     
    568672    }
    569673
    570     SHOW_STRING_PROP(      machine, Name,                       "name",                 "Name");
     674    SHOW_STRING_PROP(      machine, Name,                       "name",                 "Name:");
    571675
    572676    Bstr osTypeId;
     
    574678    ComPtr<IGuestOSType> osType;
    575679    CHECK_ERROR2I_RET(pVirtualBox, GetGuestOSType(osTypeId.raw(), osType.asOutParam()), hrcCheck);
    576     SHOW_STRINGARRAY_PROP( machine, Groups,                     "groups",               "Groups");
    577     SHOW_STRING_PROP(       osType, Description,                "ostype",               "Guest OS");
    578     SHOW_UUID_PROP(        machine, Id,                         "UUID",                 "UUID");
    579     SHOW_STRING_PROP(      machine, SettingsFilePath,           "CfgFile",              "Config file");
    580     SHOW_STRING_PROP(      machine, SnapshotFolder,             "SnapFldr",             "Snapshot folder");
    581     SHOW_STRING_PROP(      machine, LogFolder,                  "LogFldr",              "Log folder");
    582     SHOW_UUID_PROP(        machine, HardwareUUID,               "hardwareuuid",         "Hardware UUID");
     680    SHOW_STRINGARRAY_PROP( machine, Groups,                     "groups",               "Groups:");
     681    SHOW_STRING_PROP(       osType, Description,                "ostype",               "Guest OS:");
     682    SHOW_UUID_PROP(        machine, Id,                         "UUID",                 "UUID:");
     683    SHOW_STRING_PROP(      machine, SettingsFilePath,           "CfgFile",              "Config file:");
     684    SHOW_STRING_PROP(      machine, SnapshotFolder,             "SnapFldr",             "Snapshot folder:");
     685    SHOW_STRING_PROP(      machine, LogFolder,                  "LogFldr",              "Log folder:");
     686    SHOW_UUID_PROP(        machine, HardwareUUID,               "hardwareuuid",         "Hardware UUID:");
    583687    SHOW_ULONG_PROP(       machine, MemorySize,                 "memory",               "Memory size",      "MB");
    584     SHOW_BOOLEAN_PROP(     machine, PageFusionEnabled,          "pagefusion",           "Page Fusion");
    585     SHOW_ULONG_PROP(       machine, VRAMSize,                   "vram",                 "VRAM size",        "MB");
    586     SHOW_ULONG_PROP(       machine, CPUExecutionCap,            "cpuexecutioncap",      "CPU exec cap",     "%%");
    587     SHOW_BOOLEAN_PROP(     machine, HPETEnabled,                "hpet",                 "HPET");
    588     SHOW_STRING_PROP_MAJ(  machine, CPUProfile,                 "cpu-profile",          "CPUProfile",       "host", 6);
     688    SHOW_BOOLEAN_PROP(     machine, PageFusionEnabled,          "pagefusion",           "Page Fusion:");
     689    SHOW_ULONG_PROP(       machine, VRAMSize,                   "vram",                 "VRAM size:",        "MB");
     690    SHOW_ULONG_PROP(       machine, CPUExecutionCap,            "cpuexecutioncap",      "CPU exec cap:",     "%");
     691    SHOW_BOOLEAN_PROP(     machine, HPETEnabled,                "hpet",                 "HPET:");
     692    SHOW_STRING_PROP_MAJ(  machine, CPUProfile,                 "cpu-profile",          "CPUProfile:",       "host", 6);
    589693
    590694    ChipsetType_T chipsetType;
     
    598702        default:                AssertFailed(); pszChipsetType = "unknown"; break;
    599703    }
    600     if (details == VMINFO_MACHINEREADABLE)
    601         RTPrintf("chipset=\"%s\"\n", pszChipsetType);
    602     else
    603         RTPrintf("Chipset:         %s\n", pszChipsetType);
     704    SHOW_UTF8_STRING("chipset", "Chipset:", pszChipsetType);
    604705
    605706    FirmwareType_T firmwareType;
     
    615716        default:                    AssertFailed(); pszFirmwareType = "unknown"; break;
    616717    }
    617     if (details == VMINFO_MACHINEREADABLE)
    618         RTPrintf("firmware=\"%s\"\n", pszFirmwareType);
    619     else
    620         RTPrintf("Firmware:        %s\n", pszFirmwareType);
    621 
    622     SHOW_ULONG_PROP(       machine, CPUCount,                   "cpus",                 "Number of CPUs", "");
    623     SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_PAE, &f), "pae", "PAE");
    624     SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_LongMode, &f), "longmode", "Long Mode");
    625     SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_TripleFaultReset, &f), "triplefaultreset", "Triple Fault Reset");
    626     SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_APIC, &f), "apic", "APIC");
    627     SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_X2APIC, &f), "x2apic", "X2APIC");
    628     SHOW_ULONG_PROP(       machine, CPUIDPortabilityLevel, "cpuid-portability-level",   "CPUID Portability Level", "");
     718    SHOW_UTF8_STRING("firmware", "Firmware:", pszFirmwareType);
     719
     720    SHOW_ULONG_PROP(       machine, CPUCount,                   "cpus",                 "Number of CPUs:", "");
     721    SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_PAE, &f), "pae", "PAE:");
     722    SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_LongMode, &f), "longmode", "Long Mode:");
     723    SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_TripleFaultReset, &f), "triplefaultreset", "Triple Fault Reset:");
     724    SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_APIC, &f), "apic", "APIC:");
     725    SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_X2APIC, &f), "x2apic", "X2APIC:");
     726    SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_X2APIC, &f), "nested-hw-virt", "Nested VT-x/AMD-V:");
     727    SHOW_ULONG_PROP(       machine, CPUIDPortabilityLevel, "cpuid-portability-level",   "CPUID Portability Level:", "");
    629728
    630729    if (details != VMINFO_MACHINEREADABLE)
    631         RTPrintf("CPUID overrides: ");
     730        RTPrintf("%-28s ", "CPUID overrides:");
    632731    ULONG uOrdinal = 0;
    633732    for (uOrdinal = 0; uOrdinal < _4K; uOrdinal++)
     
    642741            {
    643742                if (!uOrdinal)
    644                     RTPrintf("Leaf no.       EAX      EBX      ECX      EDX\n");
    645                 RTPrintf("                 %08x/%03x  %08x %08x %08x %08x\n", uLeaf, uSubLeaf, uEAX, uEBX, uECX, uEDX);
     743                    RTPrintf("Leaf no.      EAX      EBX      ECX      EDX\n");
     744                RTPrintf("%-28s %08x/%03x  %08x %08x %08x %08x\n", "", uLeaf, uSubLeaf, uEAX, uEBX, uECX, uEDX);
    646745            }
    647746        }
     
    653752        }
    654753    }
    655 
    656754    if (!uOrdinal && details != VMINFO_MACHINEREADABLE)
    657755        RTPrintf("None\n");
     
    680778                pszBootMenu = "message and menu";
    681779    }
    682     if (details == VMINFO_MACHINEREADABLE)
    683         RTPrintf("bootmenu=\"%s\"\n", pszBootMenu);
    684     else
    685         RTPrintf("Boot menu mode:  %s\n", pszBootMenu);
     780    SHOW_UTF8_STRING("bootmenu", "Boot menu mode:", pszBootMenu);
    686781
    687782    ComPtr<ISystemProperties> systemProperties;
     
    693788        DeviceType_T bootOrder;
    694789        CHECK_ERROR2I_RET(machine, GetBootOrder(i, &bootOrder), hrcCheck);
     790        const char *pszDevice;
    695791        if (bootOrder == DeviceType_Floppy)
    696         {
    697             if (details == VMINFO_MACHINEREADABLE)
    698                 RTPrintf("boot%d=\"floppy\"\n", i);
    699             else
    700                 RTPrintf("Boot Device (%d): Floppy\n", i);
    701         }
     792            pszDevice = details == VMINFO_MACHINEREADABLE ? "floppy"        : "Floppy";
    702793        else if (bootOrder == DeviceType_DVD)
    703         {
    704             if (details == VMINFO_MACHINEREADABLE)
    705                 RTPrintf("boot%d=\"dvd\"\n", i);
    706             else
    707                 RTPrintf("Boot Device (%d): DVD\n", i);
    708         }
     794            pszDevice = details == VMINFO_MACHINEREADABLE ? "dvd"           : "DVD";
    709795        else if (bootOrder == DeviceType_HardDisk)
    710         {
    711             if (details == VMINFO_MACHINEREADABLE)
    712                 RTPrintf("boot%d=\"disk\"\n", i);
    713             else
    714                 RTPrintf("Boot Device (%d): HardDisk\n", i);
    715         }
     796            pszDevice = details == VMINFO_MACHINEREADABLE ? "disk"          : "HardDisk";
    716797        else if (bootOrder == DeviceType_Network)
    717         {
    718             if (details == VMINFO_MACHINEREADABLE)
    719                 RTPrintf("boot%d=\"net\"\n", i);
    720             else
    721                 RTPrintf("Boot Device (%d): Network\n", i);
    722         }
     798            pszDevice = details == VMINFO_MACHINEREADABLE ? "net"           : "Network";
    723799        else if (bootOrder == DeviceType_USB)
    724         {
    725             if (details == VMINFO_MACHINEREADABLE)
    726                 RTPrintf("boot%d=\"usb\"\n", i);
    727             else
    728                 RTPrintf("Boot Device (%d): USB\n", i);
    729         }
     800            pszDevice = details == VMINFO_MACHINEREADABLE ? "usb"           : "USB";
    730801        else if (bootOrder == DeviceType_SharedFolder)
    731         {
    732             if (details == VMINFO_MACHINEREADABLE)
    733                 RTPrintf("boot%d=\"sharedfolder\"\n", i);
    734             else
    735                 RTPrintf("Boot Device (%d): Shared Folder\n", i);
    736         }
     802            pszDevice = details == VMINFO_MACHINEREADABLE ? "sharedfolder"  : "Shared Folder";
    737803        else
    738         {
    739             if (details == VMINFO_MACHINEREADABLE)
    740                 RTPrintf("boot%d=\"none\"\n", i);
    741             else
    742                 RTPrintf("Boot Device (%d): Not Assigned\n", i);
    743         }
    744     }
    745 
    746     SHOW_BOOLEAN_PROP(biosSettings, ACPIEnabled,                "acpi",                 "ACPI");
    747     SHOW_BOOLEAN_PROP(biosSettings, IOAPICEnabled,              "ioapic",               "IOAPIC");
     804            pszDevice = details == VMINFO_MACHINEREADABLE ? "none"          : "Not Assigned";
     805        SHOW_UTF8_STRING(FmtNm(szNm, "boot%u", i), FmtNm(szNm, "Boot Device %u:", i), pszDevice);
     806    }
     807
     808    SHOW_BOOLEAN_PROP(biosSettings, ACPIEnabled,                "acpi",                 "ACPI:");
     809    SHOW_BOOLEAN_PROP(biosSettings, IOAPICEnabled,              "ioapic",               "IOAPIC:");
    748810
    749811    APICMode_T apicMode;
     
    769831            break;
    770832    }
    771     if (details == VMINFO_MACHINEREADABLE)
    772         RTPrintf("biosapic=\"%s\"\n", pszAPIC);
    773     else
    774         RTPrintf("BIOS APIC mode:  %s\n", pszAPIC);
    775 
    776     SHOW_LONG64_PROP(biosSettings,  TimeOffset,                 "biossystemtimeoffset", "Time offset",  "ms");
    777     SHOW_BOOLEAN_PROP_EX(machine,   RTCUseUTC,                  "rtcuseutc",            "RTC",          "UTC", "local time");
    778     SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_Enabled,   &f),   "hwvirtex",     "Hardw. virt.ext");
    779     SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &f),"nestedpaging", "Nested Paging");
    780     SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &f),  "largepages",   "Large Pages");
    781     SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_VPID, &f),        "vtxvpid",      "VT-x VPID");
    782     SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, &f), "vtxux", "VT-x unr. exec.");
     833    SHOW_UTF8_STRING("biosapic", "BIOS APIC mode:", pszAPIC);
     834
     835    SHOW_LONG64_PROP(biosSettings,  TimeOffset,                 "biossystemtimeoffset", "Time offset:",  "ms");
     836    SHOW_BOOLEAN_PROP_EX(machine,   RTCUseUTC,                  "rtcuseutc",            "RTC:",         "UTC", "local time");
     837    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_Enabled,   &f),   "hwvirtex",     "Hardw. virt.ext:");
     838    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &f),"nestedpaging", "Nested Paging:");
     839    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &f),  "largepages",   "Large Pages:");
     840    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_VPID, &f),        "vtxvpid",      "VT-x VPID:");
     841    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, &f), "vtxux", "VT-x unr. exec.:");
    783842
    784843    ParavirtProvider_T paravirtProvider;
    785844    CHECK_ERROR2I_RET(machine, COMGETTER(ParavirtProvider)(&paravirtProvider), hrcCheck);
    786845    const char *pszParavirtProvider = paravirtProviderToString(paravirtProvider, details);
    787     if (details == VMINFO_MACHINEREADABLE)
    788         RTPrintf("paravirtprovider=\"%s\"\n", pszParavirtProvider);
    789     else
    790         RTPrintf("Paravirt. Provider: %s\n", pszParavirtProvider);
     846    SHOW_UTF8_STRING("paravirtprovider", "Paravirt. Provider:", pszParavirtProvider);
    791847
    792848    ParavirtProvider_T effParavirtProvider;
    793849    CHECK_ERROR2I_RET(machine, GetEffectiveParavirtProvider(&effParavirtProvider), hrcCheck);
    794850    const char *pszEffParavirtProvider = paravirtProviderToString(effParavirtProvider, details);
    795     if (details == VMINFO_MACHINEREADABLE)
    796         RTPrintf("effparavirtprovider=\"%s\"\n", pszEffParavirtProvider);
    797     else
    798         RTPrintf("Effective Paravirt. Provider: %s\n", pszEffParavirtProvider);
     851    SHOW_UTF8_STRING("effparavirtprovider", "Effective Paravirt. Prov.:", pszEffParavirtProvider);
    799852
    800853    Bstr paravirtDebug;
    801854    CHECK_ERROR2I_RET(machine, COMGETTER(ParavirtDebug)(paravirtDebug.asOutParam()), hrcCheck);
    802855    if (paravirtDebug.isNotEmpty())
    803     {
    804         if (details == VMINFO_MACHINEREADABLE)
    805             RTPrintf("paravirtdebug=\"%ls\"\n", paravirtDebug.raw());
    806         else
    807             RTPrintf("Paravirt. Debug: %ls\n", paravirtDebug.raw());
    808     }
     856        SHOW_BSTR_STRING("paravirtdebug", "Paravirt. Debug:", paravirtDebug);
    809857
    810858    MachineState_T machineState;
     
    829877    }
    830878    else
    831         RTPrintf("State:           %s (since %s)\n", pszState, pszTime);
    832 
    833     SHOW_ULONG_PROP(      machine,  MonitorCount,               "monitorcount",             "Monitor count", "");
    834     SHOW_BOOLEAN_PROP(    machine,  Accelerate3DEnabled,        "accelerate3d",             "3D Acceleration");
     879        RTPrintf("%-28s %s (since %s)\n", "State:", pszState, pszTime);
     880
     881    SHOW_ULONG_PROP(      machine,  MonitorCount,               "monitorcount",             "Monitor count:", "");
     882    SHOW_BOOLEAN_PROP(    machine,  Accelerate3DEnabled,        "accelerate3d",             "3D Acceleration:");
    835883#ifdef VBOX_WITH_VIDEOHWACCEL
    836     SHOW_BOOLEAN_PROP(    machine,  Accelerate2DVideoEnabled,   "accelerate2dvideo",        "2D Video Acceleration");
     884    SHOW_BOOLEAN_PROP(    machine,  Accelerate2DVideoEnabled,   "accelerate2dvideo",        "2D Video Acceleration:");
    837885#endif
    838     SHOW_BOOLEAN_PROP(    machine,  TeleporterEnabled,          "teleporterenabled",        "Teleporter Enabled");
    839     SHOW_ULONG_PROP(      machine,  TeleporterPort,             "teleporterport",           "Teleporter Port", "");
    840     SHOW_STRING_PROP(     machine,  TeleporterAddress,          "teleporteraddress",        "Teleporter Address");
    841     SHOW_STRING_PROP(     machine,  TeleporterPassword,         "teleporterpassword",       "Teleporter Password");
    842     SHOW_BOOLEAN_PROP(    machine,  TracingEnabled,             "tracing-enabled",          "Tracing Enabled");
    843     SHOW_BOOLEAN_PROP(    machine,  AllowTracingToAccessVM,     "tracing-allow-vm-access",  "Allow Tracing to Access VM");
    844     SHOW_STRING_PROP(     machine,  TracingConfig,              "tracing-config",           "Tracing Configuration");
    845     SHOW_BOOLEAN_PROP(    machine,  AutostartEnabled,           "autostart-enabled",        "Autostart Enabled");
    846     SHOW_ULONG_PROP(      machine,  AutostartDelay,             "autostart-delay",          "Autostart Delay", "");
    847     SHOW_STRING_PROP(     machine,  DefaultFrontend,            "defaultfrontend",          "Default Frontend");
     886    SHOW_BOOLEAN_PROP(    machine,  TeleporterEnabled,          "teleporterenabled",        "Teleporter Enabled:");
     887    SHOW_ULONG_PROP(      machine,  TeleporterPort,             "teleporterport",           "Teleporter Port:", "");
     888    SHOW_STRING_PROP(     machine,  TeleporterAddress,          "teleporteraddress",        "Teleporter Address:");
     889    SHOW_STRING_PROP(     machine,  TeleporterPassword,         "teleporterpassword",       "Teleporter Password:");
     890    SHOW_BOOLEAN_PROP(    machine,  TracingEnabled,             "tracing-enabled",          "Tracing Enabled:");
     891    SHOW_BOOLEAN_PROP(    machine,  AllowTracingToAccessVM,     "tracing-allow-vm-access",  "Allow Tracing to Access VM:");
     892    SHOW_STRING_PROP(     machine,  TracingConfig,              "tracing-config",           "Tracing Configuration:");
     893    SHOW_BOOLEAN_PROP(    machine,  AutostartEnabled,           "autostart-enabled",        "Autostart Enabled:");
     894    SHOW_ULONG_PROP(      machine,  AutostartDelay,             "autostart-delay",          "Autostart Delay:", "");
     895    SHOW_STRING_PROP(     machine,  DefaultFrontend,            "defaultfrontend",          "Default Frontend:");
    848896
    849897/** @todo Convert the remainder of the function to SHOW_XXX macros and add error
     
    10441092        if (SUCCEEDED(rc) && nic)
    10451093        {
     1094            FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "nic%u" : "NIC %u:", currentNIC + 1);
     1095
    10461096            BOOL fEnabled;
    10471097            nic->COMGETTER(Enabled)(&fEnabled);
     
    10491099            {
    10501100                if (details == VMINFO_MACHINEREADABLE)
    1051                     RTPrintf("nic%d=\"none\"\n", currentNIC + 1);
     1101                    RTPrintf("%s=\"none\"\n", szNm);
    10521102                else
    1053                     RTPrintf("NIC %d:           disabled\n", currentNIC + 1);
     1103                    RTPrintf("%-28s disabled\n", szNm);
    10541104            }
    10551105            else
     
    13261376                }
    13271377                else
    1328                     RTPrintf("NIC %u:          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",
    1329                              currentNIC + 1, strMACAddress.raw(), strAttachment.c_str(),
     1378                    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",
     1379                             szNm, strMACAddress.raw(), strAttachment.c_str(),
    13301380                             fConnected ? "on" : "off",
    13311381                             fTraceEnabled ? "on" : "off",
     
    13781428            break;
    13791429    }
    1380     if (details == VMINFO_MACHINEREADABLE)
    1381         RTPrintf("hidpointing=\"%s\"\n", pszMrHID);
    1382     else
    1383         RTPrintf("Pointing Device: %s\n", pszHID);
     1430    SHOW_UTF8_STRING("hidpointing", "Pointing Device:", details == VMINFO_MACHINEREADABLE ? pszMrHID : pszHID);
    13841431
    13851432    /* Keyboard device information */
     
    14091456            break;
    14101457    }
    1411     if (details == VMINFO_MACHINEREADABLE)
    1412         RTPrintf("hidkeyboard=\"%s\"\n", pszMrHID);
    1413     else
    1414         RTPrintf("Keyboard Device: %s\n", pszHID);
     1458    SHOW_UTF8_STRING("hidkeyboard", "Keyboard Device:", details == VMINFO_MACHINEREADABLE ? pszMrHID : pszHID);
    14151459
    14161460    ComPtr<ISystemProperties> sysProps;
     
    14261470        if (SUCCEEDED(rc) && uart)
    14271471        {
     1472            FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "uart%u" : "UART %u:", currentUART + 1);
     1473
    14281474            /* show the config of this UART */
    14291475            BOOL fEnabled;
     
    14321478            {
    14331479                if (details == VMINFO_MACHINEREADABLE)
    1434                     RTPrintf("uart%d=\"off\"\n", currentUART + 1);
     1480                    RTPrintf("%s=\"off\"\n", szNm);
    14351481                else
    1436                     RTPrintf("UART %d:          disabled\n", currentUART + 1);
     1482                    RTPrintf("%-28s disabled\n", szNm);
    14371483            }
    14381484            else
     
    14491495
    14501496                if (details == VMINFO_MACHINEREADABLE)
    1451                     RTPrintf("uart%d=\"%#06x,%d\"\n", currentUART + 1,
    1452                              ulIOBase, ulIRQ);
     1497                    RTPrintf("%s=\"%#06x,%d\"\n", szNm, ulIOBase, ulIRQ);
    14531498                else
    1454                     RTPrintf("UART %d:          I/O base: %#06x, IRQ: %d",
    1455                              currentUART + 1, ulIOBase, ulIRQ);
     1499                    RTPrintf("%-28s I/O base: %#06x, IRQ: %d", szNm, ulIOBase, ulIRQ);
    14561500                switch (HostMode)
    14571501                {
     
    15081552        if (SUCCEEDED(rc) && lpt)
    15091553        {
     1554            FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "lpt%u" : "LPT %u:", currentLPT + 1);
     1555
    15101556            /* show the config of this LPT */
    15111557            BOOL fEnabled;
     
    15141560            {
    15151561                if (details == VMINFO_MACHINEREADABLE)
    1516                     RTPrintf("lpt%d=\"off\"\n", currentLPT + 1);
     1562                    RTPrintf("%s=\"off\"\n", szNm);
    15171563                else
    1518                     RTPrintf("LPT %d:           disabled\n", currentLPT + 1);
     1564                    RTPrintf("%-28s disabled\n", szNm);
    15191565            }
    15201566            else
     
    15271573
    15281574                if (details == VMINFO_MACHINEREADABLE)
    1529                     RTPrintf("lpt%d=\"%#06x,%d\"\n", currentLPT + 1,
    1530                              ulIOBase, ulIRQ);
     1575                    RTPrintf("%s=\"%#06x,%d\"\n", szNm, ulIOBase, ulIRQ);
    15311576                else
    1532                     RTPrintf("LPT %d:           I/O base: %#06x, IRQ: %d",
    1533                              currentLPT + 1, ulIOBase, ulIRQ);
     1577                    RTPrintf("%-28s I/O base: %#06x, IRQ: %d", szNm, ulIOBase, ulIRQ);
    15341578                if (details == VMINFO_MACHINEREADABLE)
    1535                     RTPrintf("lptmode%d=\"%ls\"\n", currentLPT + 1,
    1536                             path.raw());
     1579                    RTPrintf("lptmode%d=\"%ls\"\n", currentLPT + 1, path.raw());
    15371580                else
    15381581                    RTPrintf(", attached to device '%ls'\n", path.raw());
     
    16571700            fEnabled = FALSE;
    16581701
    1659         BOOL fEnabledIn = false;
    1660         CHECK_ERROR(AudioAdapter, COMGETTER(EnabledIn)(&fEnabledIn));
    1661 
    1662         BOOL fEnabledOut = false;
    1663         CHECK_ERROR(AudioAdapter,  COMGETTER(EnabledOut)(&fEnabledOut));
    1664 
    16651702        if (details == VMINFO_MACHINEREADABLE)
    1666         {
     1703            RTPrintf("audio=\"%s\"\n", fEnabled ? pszDrv : "none");
     1704        else
     1705        {
     1706            RTPrintf("%-28s %s", "Audio:", fEnabled ? "enabled" : "disabled");
    16671707            if (fEnabled)
    1668                 RTPrintf("audio=\"%s\"\n", pszDrv);
    1669             else
    1670                 RTPrintf("audio=\"none\"\n");
    1671 
    1672             RTPrintf("audio_in=\"%s\"\n",  fEnabledIn  ? "true" : "false");
    1673             RTPrintf("audio_out=\"%s\"\n", fEnabledOut ? "true" : "false");
    1674         }
    1675         else
    1676         {
    1677             RTPrintf("Audio:           %s",
    1678                     fEnabled ? "enabled" : "disabled");
    1679             if (fEnabled)
    1680                 RTPrintf(" (Driver: %s, Controller: %s, Codec: %s)",
    1681                     pszDrv, pszCtrl, pszCodec);
     1708                RTPrintf(" (Driver: %s, Controller: %s, Codec: %s)", pszDrv, pszCtrl, pszCodec);
    16821709            RTPrintf("\n");
    1683 
    1684             RTPrintf("Audio playback:  %s\n", fEnabledIn  ? "enabled" : "disabled");
    1685             RTPrintf("Audio capture: %s\n", fEnabledOut ? "enabled" : "disabled");
    1686         }
     1710        }
     1711        SHOW_BOOLEAN_PROP(AudioAdapter, EnabledIn,  "audio_in",  "Audio playback:");
     1712        SHOW_BOOLEAN_PROP(AudioAdapter, EnabledOut, "audio_out", "Audio capture:");
    16871713    }
    16881714
    16891715    /* Shared clipboard */
    16901716    {
    1691         const char *psz = "Unknown";
    1692         ClipboardMode_T enmMode;
     1717        const char *psz;
     1718        ClipboardMode_T enmMode = (ClipboardMode_T)0;
    16931719        rc = machine->COMGETTER(ClipboardMode)(&enmMode);
    16941720        switch (enmMode)
    16951721        {
    16961722            case ClipboardMode_Disabled:
    1697                 if (details == VMINFO_MACHINEREADABLE)
    1698                     psz = "disabled";
    1699                 else
    1700                     psz = "disabled";
     1723                psz = "disabled";
    17011724                break;
    17021725            case ClipboardMode_HostToGuest:
    1703                 if (details == VMINFO_MACHINEREADABLE)
    1704                     psz = "hosttoguest";
    1705                 else
    1706                     psz = "HostToGuest";
     1726                psz = details == VMINFO_MACHINEREADABLE ? "hosttoguest" : "HostToGuest";
    17071727                break;
    17081728            case ClipboardMode_GuestToHost:
    1709                 if (details == VMINFO_MACHINEREADABLE)
    1710                     psz = "guesttohost";
    1711                 else
    1712                     psz = "GuestToHost";
     1729                psz = details == VMINFO_MACHINEREADABLE ? "guesttohost" : "GuestToHost";
    17131730                break;
    17141731            case ClipboardMode_Bidirectional:
    1715                 if (details == VMINFO_MACHINEREADABLE)
    1716                     psz = "bidirectional";
    1717                 else
    1718                     psz = "Bidirectional";
     1732                psz = details == VMINFO_MACHINEREADABLE ? "bidirectional" : "Bidirectional";
    17191733                break;
    17201734            default:
    1721                 if (details == VMINFO_MACHINEREADABLE)
    1722                     psz = "unknown";
     1735                psz = details == VMINFO_MACHINEREADABLE ? "unknown" : "Unknown";
    17231736                break;
    17241737        }
    1725         if (details == VMINFO_MACHINEREADABLE)
    1726             RTPrintf("clipboard=\"%s\"\n", psz);
    1727         else
    1728             RTPrintf("Clipboard Mode:  %s\n", psz);
     1738        SHOW_UTF8_STRING("clipboard", "Clipboard Mode:", psz);
    17291739    }
    17301740
    17311741    /* Drag and drop */
    17321742    {
    1733         const char *psz = "Unknown";
     1743        const char *psz;
    17341744        DnDMode_T enmMode;
    17351745        rc = machine->COMGETTER(DnDMode)(&enmMode);
     
    17371747        {
    17381748            case DnDMode_Disabled:
    1739                 if (details == VMINFO_MACHINEREADABLE)
    1740                     psz = "disabled";
    1741                 else
    1742                     psz = "disabled";
     1749                psz = "disabled";
    17431750                break;
    17441751            case DnDMode_HostToGuest:
    1745                 if (details == VMINFO_MACHINEREADABLE)
    1746                     psz = "hosttoguest";
    1747                 else
    1748                     psz = "HostToGuest";
     1752                psz = details == VMINFO_MACHINEREADABLE ? "hosttoguest" : "HostToGuest";
    17491753                break;
    17501754            case DnDMode_GuestToHost:
    1751                 if (details == VMINFO_MACHINEREADABLE)
    1752                     psz = "guesttohost";
    1753                 else
    1754                     psz = "GuestToHost";
     1755                psz = details == VMINFO_MACHINEREADABLE ? "guesttohost" : "GuestToHost";
    17551756                break;
    17561757            case DnDMode_Bidirectional:
    1757                 if (details == VMINFO_MACHINEREADABLE)
    1758                     psz = "bidirectional";
    1759                 else
    1760                     psz = "Bidirectional";
     1758                psz = details == VMINFO_MACHINEREADABLE ? "bidirectional" : "Bidirectional";
    17611759                break;
    17621760            default:
    1763                 if (details == VMINFO_MACHINEREADABLE)
    1764                     psz = "unknown";
     1761                psz = details == VMINFO_MACHINEREADABLE ? "unknown" : "Unknown";
    17651762                break;
    17661763        }
    1767         if (details == VMINFO_MACHINEREADABLE)
    1768             RTPrintf("draganddrop=\"%s\"\n", psz);
    1769         else
    1770             RTPrintf("Drag and drop Mode: %s\n", psz);
     1764        SHOW_UTF8_STRING("draganddrop", "Drag and drop Mode:", psz);
    17711765    }
    17721766
     
    17791773            rc = machine->COMGETTER(SessionName)(sessName.asOutParam());
    17801774            if (SUCCEEDED(rc) && !sessName.isEmpty())
    1781             {
    1782                 if (details == VMINFO_MACHINEREADABLE)
    1783                     RTPrintf("SessionName=\"%ls\"\n", sessName.raw());
    1784                 else
    1785                     RTPrintf("Session name:    %ls\n", sessName.raw());
    1786             }
     1775                SHOW_BSTR_STRING("SessionName", "Session name:", sessName);
    17871776        }
    17881777    }
     
    18251814                    default: break;
    18261815                }
    1827                 RTPrintf("Video mode:      %dx%dx%d at %d,%d %s\n", xRes, yRes, bpp, xOrigin, yOrigin, pszMonitorStatus);
     1816                RTPrintf("%-28s %dx%dx%d at %d,%d %s\n", "Video mode:", xRes, yRes, bpp, xOrigin, yOrigin, pszMonitorStatus);
    18281817            }
    18291818        }
     
    19111900                if (address.isEmpty())
    19121901                    address = "0.0.0.0";
    1913                 RTPrintf("VRDE:            enabled (Address %ls, Ports %ls, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n", address.raw(), ports.raw(), fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType);
     1902                RTPrintf("%-28s enabled (Address %ls, Ports %ls, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n",
     1903                         "VRDE:", address.raw(), ports.raw(), fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType);
    19141904                if (pConsole && currentPort != -1 && currentPort != 0)
    1915                    RTPrintf("VRDE port:       %d\n", currentPort);
     1905                   RTPrintf("%-28s %d\n", "VRDE port:", currentPort);
    19161906                if (fVideoChannel)
    1917                     RTPrintf("Video redirection: enabled (Quality %ls)\n", videoChannelQuality.raw());
     1907                    RTPrintf("%-28s enabled (Quality %ls)\n", "Video redirection:", videoChannelQuality.raw());
    19181908                else
    1919                     RTPrintf("Video redirection: disabled\n");
     1909                    RTPrintf("%-28s disabled\n", "Video redirection:");
    19201910            }
    19211911            com::SafeArray<BSTR> aProperties;
     
    19371927                    {
    19381928                        if (value.isEmpty())
    1939                             RTPrintf("VRDE property: %-10lS = <not set>\n", aProperties[i]);
     1929                            RTPrintf("%-28s: %-10lS = <not set>\n", "VRDE property", aProperties[i]);
    19401930                        else
    1941                             RTPrintf("VRDE property: %-10lS = \"%ls\"\n", aProperties[i], value.raw());
     1931                            RTPrintf("%-28s: %-10lS = \"%ls\"\n", "VRDE property", aProperties[i], value.raw());
    19421932                    }
    19431933                }
     
    19491939                RTPrintf("vrde=\"off\"\n");
    19501940            else
    1951                 RTPrintf("VRDE:            disabled\n");
     1941                RTPrintf("%-28s disabled\n", "VRDE:");
    19521942        }
    19531943    }
     
    19881978        }
    19891979
    1990         if (details == VMINFO_MACHINEREADABLE)
    1991             RTPrintf("usb=\"%s\"\n", fOhciEnabled ? "on" : "off");
    1992         else
    1993             RTPrintf("OHCI USB:        %s\n", fOhciEnabled ? "enabled" : "disabled");
    1994 
    1995         if (details == VMINFO_MACHINEREADABLE)
    1996             RTPrintf("ehci=\"%s\"\n", fEhciEnabled ? "on" : "off");
    1997         else
    1998             RTPrintf("EHCI USB:        %s\n", fEhciEnabled ? "enabled" : "disabled");
    1999 
    2000         if (details == VMINFO_MACHINEREADABLE)
    2001             RTPrintf("xhci=\"%s\"\n", fXhciEnabled ? "on" : "off");
    2002         else
    2003             RTPrintf("xHCI USB:        %s\n", fXhciEnabled ? "enabled" : "disabled");
     1980        SHOW_BOOL_VALUE("usb",  "OHCI USB:", fOhciEnabled);
     1981        SHOW_BOOL_VALUE("ehci", "EHCI USB:", fEhciEnabled);
     1982        SHOW_BOOL_VALUE("xhci", "xHCI USB:", fXhciEnabled);
    20041983    }
    20051984
     
    20262005                    ComPtr<IUSBDeviceFilter> DevPtr = Coll[index];
    20272006
    2028                     /* Query info. */
    2029 
    20302007                    if (details != VMINFO_MACHINEREADABLE)
    2031                         RTPrintf("Index:            %zu\n", index);
    2032 
    2033                     BOOL bActive = FALSE;
    2034                     CHECK_ERROR_RET(DevPtr, COMGETTER(Active)(&bActive), rc);
    2035                     if (details == VMINFO_MACHINEREADABLE)
    2036                         RTPrintf("USBFilterActive%zu=\"%s\"\n", index + 1, bActive ? "on" : "off");
    2037                     else
    2038                         RTPrintf("Active:           %s\n", bActive ? "yes" : "no");
    2039 
    2040                     Bstr bstr;
    2041                     CHECK_ERROR_RET(DevPtr, COMGETTER(Name)(bstr.asOutParam()), rc);
    2042                     if (details == VMINFO_MACHINEREADABLE)
    2043                         RTPrintf("USBFilterName%zu=\"%ls\"\n", index + 1, bstr.raw());
    2044                     else
    2045                         RTPrintf("Name:             %ls\n", bstr.raw());
    2046                     CHECK_ERROR_RET(DevPtr, COMGETTER(VendorId)(bstr.asOutParam()), rc);
    2047                     if (details == VMINFO_MACHINEREADABLE)
    2048                         RTPrintf("USBFilterVendorId%zu=\"%ls\"\n", index + 1, bstr.raw());
    2049                     else
    2050                         RTPrintf("VendorId:         %ls\n", bstr.raw());
    2051                     CHECK_ERROR_RET(DevPtr, COMGETTER(ProductId)(bstr.asOutParam()), rc);
    2052                     if (details == VMINFO_MACHINEREADABLE)
    2053                         RTPrintf("USBFilterProductId%zu=\"%ls\"\n", index + 1, bstr.raw());
    2054                     else
    2055                         RTPrintf("ProductId:        %ls\n", bstr.raw());
    2056                     CHECK_ERROR_RET(DevPtr, COMGETTER(Revision)(bstr.asOutParam()), rc);
    2057                     if (details == VMINFO_MACHINEREADABLE)
    2058                         RTPrintf("USBFilterRevision%zu=\"%ls\"\n", index + 1, bstr.raw());
    2059                     else
    2060                         RTPrintf("Revision:         %ls\n", bstr.raw());
    2061                     CHECK_ERROR_RET(DevPtr, COMGETTER(Manufacturer)(bstr.asOutParam()), rc);
    2062                     if (details == VMINFO_MACHINEREADABLE)
    2063                         RTPrintf("USBFilterManufacturer%zu=\"%ls\"\n", index + 1, bstr.raw());
    2064                     else
    2065                         RTPrintf("Manufacturer:     %ls\n", bstr.raw());
    2066                     CHECK_ERROR_RET(DevPtr, COMGETTER(Product)(bstr.asOutParam()), rc);
    2067                     if (details == VMINFO_MACHINEREADABLE)
    2068                         RTPrintf("USBFilterProduct%zu=\"%ls\"\n", index + 1, bstr.raw());
    2069                     else
    2070                         RTPrintf("Product:          %ls\n", bstr.raw());
    2071                     CHECK_ERROR_RET(DevPtr, COMGETTER(Remote)(bstr.asOutParam()), rc);
    2072                     if (details == VMINFO_MACHINEREADABLE)
    2073                         RTPrintf("USBFilterRemote%zu=\"%ls\"\n", index + 1, bstr.raw());
    2074                     else
    2075                         RTPrintf("Remote:           %ls\n", bstr.raw());
    2076                     CHECK_ERROR_RET(DevPtr, COMGETTER(SerialNumber)(bstr.asOutParam()), rc);
    2077                     if (details == VMINFO_MACHINEREADABLE)
    2078                         RTPrintf("USBFilterSerialNumber%zu=\"%ls\"\n", index + 1, bstr.raw());
    2079                     else
    2080                         RTPrintf("Serial Number:    %ls\n", bstr.raw());
     2008                        SHOW_UTF8_STRING("index", "Index:", FmtNm(szNm, "%zu", index));
     2009                    SHOW_BOOLEAN_PROP_EX(DevPtr, Active,   FmtNm(szNm, "USBFilterActive%zu", index + 1),       "Active:", "yes", "no");
     2010                    SHOW_STRING_PROP(DevPtr, Name,         FmtNm(szNm, "USBFilterName%zu", index + 1),         "Name:");
     2011                    SHOW_STRING_PROP(DevPtr, VendorId,     FmtNm(szNm, "USBFilterVendorId%zu", index + 1),     "VendorId:");
     2012                    SHOW_STRING_PROP(DevPtr, ProductId,    FmtNm(szNm, "USBFilterProductId%zu", index + 1),    "ProductId:");
     2013                    SHOW_STRING_PROP(DevPtr, Revision,     FmtNm(szNm, "USBFilterRevision%zu", index + 1),     "Revision:");
     2014                    SHOW_STRING_PROP(DevPtr, Manufacturer, FmtNm(szNm, "USBFilterManufacturer%zu", index + 1), "Manufacturer:");
     2015                    SHOW_STRING_PROP(DevPtr, Product,      FmtNm(szNm, "USBFilterProduct%zu", index + 1),      "Product:");
     2016                    SHOW_STRING_PROP(DevPtr, Remote,       FmtNm(szNm, "USBFilterRemote%zu", index + 1),       "Remote:");
     2017                    SHOW_STRING_PROP(DevPtr, SerialNumber, FmtNm(szNm, "USBFilterSerialNumber%zu", index + 1),       "Serial Number:");
    20812018                    if (details != VMINFO_MACHINEREADABLE)
    20822019                    {
     
    20842021                        CHECK_ERROR_RET(DevPtr, COMGETTER(MaskedInterfaces)(&fMaskedIfs), rc);
    20852022                        if (fMaskedIfs)
    2086                             RTPrintf("Masked Interfaces: %#010x\n", fMaskedIfs);
     2023                            RTPrintf("%-28s %#010x\n", "Masked Interfaces:", fMaskedIfs);
    20872024                        RTPrintf("\n");
    20882025                    }
     
    21082045                else
    21092046                {
    2110                     for (size_t index = 0; index < coll.size(); ++index)
     2047                    /* This code is duplicated below, with USBAttach as prefix. */
     2048                    const char *pszPfx = "USBRemote";
     2049                    for (size_t i = 0; i < coll.size(); ++i)
    21112050                    {
    2112                         ComPtr<IHostUSBDevice> dev = coll[index];
    2113 
    2114                         /* Query info. */
    2115                         Bstr id;
    2116                         CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), rc);
    2117                         USHORT usVendorId;
    2118                         CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), rc);
    2119                         USHORT usProductId;
    2120                         CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), rc);
     2051                        ComPtr<IHostUSBDevice> dev = coll[i];
     2052
     2053                        SHOW_STRING_PROP(dev, Id, FmtNm(szNm, "%sActive%zu", pszPfx, i + 1), "UUID:");
     2054                        SHOW_USHORT_PROP_EX2(dev, VendorId,  FmtNm(szNm, "%sVendorId%zu", pszPfx, i + 1),  "VendorId:",  "", "%#06x", "%#06x (%04X)");
     2055                        SHOW_USHORT_PROP_EX2(dev, ProductId, FmtNm(szNm, "%sProductId%zu", pszPfx, i + 1), "ProductId:", "", "%#06x", "%#06x (%04X)");
     2056
    21212057                        USHORT bcdRevision;
    21222058                        CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), rc);
    2123 
    21242059                        if (details == VMINFO_MACHINEREADABLE)
    2125                             RTPrintf("USBRemoteUUID%zu=\"%s\"\n"
    2126                                      "USBRemoteVendorId%zu=\"%#06x\"\n"
    2127                                      "USBRemoteProductId%zu=\"%#06x\"\n"
    2128                                      "USBRemoteRevision%zu=\"%#04x%02x\"\n",
    2129                                      index + 1, Utf8Str(id).c_str(),
    2130                                      index + 1, usVendorId,
    2131                                      index + 1, usProductId,
    2132                                      index + 1, bcdRevision >> 8, bcdRevision & 0xff);
     2060                            RTStrPrintf(szValue, sizeof(szValue), "%#04x%02x", bcdRevision >> 8, bcdRevision & 0xff);
    21332061                        else
    2134                             RTPrintf("UUID:               %s\n"
    2135                                      "VendorId:           %#06x (%04X)\n"
    2136                                      "ProductId:          %#06x (%04X)\n"
    2137                                      "Revision:           %u.%u (%02u%02u)\n",
    2138                                      Utf8Str(id).c_str(),
    2139                                      usVendorId, usVendorId, usProductId, usProductId,
    2140                                      bcdRevision >> 8, bcdRevision & 0xff,
    2141                                      bcdRevision >> 8, bcdRevision & 0xff);
    2142 
    2143                         /* optional stuff. */
    2144                         Bstr bstr;
    2145                         CHECK_ERROR_RET(dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc);
    2146                         if (!bstr.isEmpty())
    2147                         {
    2148                             if (details == VMINFO_MACHINEREADABLE)
    2149                                 RTPrintf("USBRemoteManufacturer%zu=\"%ls\"\n", index + 1, bstr.raw());
    2150                             else
    2151                                 RTPrintf("Manufacturer:       %ls\n", bstr.raw());
    2152                         }
    2153                         CHECK_ERROR_RET(dev, COMGETTER(Product)(bstr.asOutParam()), rc);
    2154                         if (!bstr.isEmpty())
    2155                         {
    2156                             if (details == VMINFO_MACHINEREADABLE)
    2157                                 RTPrintf("USBRemoteProduct%zu=\"%ls\"\n", index + 1, bstr.raw());
    2158                             else
    2159                                 RTPrintf("Product:            %ls\n", bstr.raw());
    2160                         }
    2161                         CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc);
    2162                         if (!bstr.isEmpty())
    2163                         {
    2164                             if (details == VMINFO_MACHINEREADABLE)
    2165                                 RTPrintf("USBRemoteSerialNumber%zu=\"%ls\"\n", index + 1, bstr.raw());
    2166                             else
    2167                                 RTPrintf("SerialNumber:       %ls\n", bstr.raw());
    2168                         }
    2169                         CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), rc);
    2170                         if (!bstr.isEmpty())
    2171                         {
    2172                             if (details == VMINFO_MACHINEREADABLE)
    2173                                 RTPrintf("USBRemoteAddress%zu=\"%ls\"\n", index + 1, bstr.raw());
    2174                             else
    2175                                 RTPrintf("Address:            %ls\n", bstr.raw());
    2176                         }
     2062                            RTStrPrintf(szValue, sizeof(szValue), "%u.%u (%02u%02u)\n",
     2063                                        bcdRevision >> 8, bcdRevision & 0xff, bcdRevision >> 8, bcdRevision & 0xff);
     2064                        SHOW_UTF8_STRING(FmtNm(szNm, "%sRevision%zu", pszPfx, i + 1), "Revision:", szValue);
     2065
     2066                        SHOW_STRING_PROP_NOT_EMPTY(dev, Manufacturer, FmtNm(szNm, "%sManufacturer%zu", pszPfx, i + 1), "Manufacturer:");
     2067                        SHOW_STRING_PROP_NOT_EMPTY(dev, Product,      FmtNm(szNm, "%sProduct%zu", pszPfx, i + 1),      "Product:");
     2068                        SHOW_STRING_PROP_NOT_EMPTY(dev, SerialNumber, FmtNm(szNm, "%sSerialNumber%zu", pszPfx, i + 1), "SerialNumber:");
     2069                        SHOW_STRING_PROP_NOT_EMPTY(dev, Address,      FmtNm(szNm, "%sAddress%zu", pszPfx, i + 1),      "Address:");
    21772070
    21782071                        if (details != VMINFO_MACHINEREADABLE)
     
    21972090                else
    21982091                {
    2199                     for (size_t index = 0; index < coll.size(); ++index)
     2092                    /* This code is duplicated below, with USBAttach as prefix. */
     2093                    const char *pszPfx = "USBAttach";
     2094                    for (size_t i = 0; i < coll.size(); ++i)
    22002095                    {
    2201                         ComPtr<IUSBDevice> dev = coll[index];
    2202 
    2203                         /* Query info. */
    2204                         Bstr id;
    2205                         CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), rc);
    2206                         USHORT usVendorId;
    2207                         CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), rc);
    2208                         USHORT usProductId;
    2209                         CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), rc);
     2096                        ComPtr<IHostUSBDevice> dev = coll[i];
     2097
     2098                        SHOW_STRING_PROP(dev, Id, FmtNm(szNm, "%sActive%zu", pszPfx, i + 1), "UUID:");
     2099                        SHOW_USHORT_PROP_EX2(dev, VendorId,  FmtNm(szNm, "%sVendorId%zu", pszPfx, i + 1),  "VendorId:",  "", "%#06x", "%#06x (%04X)");
     2100                        SHOW_USHORT_PROP_EX2(dev, ProductId, FmtNm(szNm, "%sProductId%zu", pszPfx, i + 1), "ProductId:", "", "%#06x", "%#06x (%04X)");
     2101
    22102102                        USHORT bcdRevision;
    22112103                        CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), rc);
    2212 
    22132104                        if (details == VMINFO_MACHINEREADABLE)
    2214                             RTPrintf("USBAttachedUUID%zu=\"%s\"\n"
    2215                                      "USBAttachedVendorId%zu=\"%#06x\"\n"
    2216                                      "USBAttachedProductId%zu=\"%#06x\"\n"
    2217                                      "USBAttachedRevision%zu=\"%#04x%02x\"\n",
    2218                                      index + 1, Utf8Str(id).c_str(),
    2219                                      index + 1, usVendorId,
    2220                                      index + 1, usProductId,
    2221                                      index + 1, bcdRevision >> 8, bcdRevision & 0xff);
     2105                            RTStrPrintf(szValue, sizeof(szValue), "%#04x%02x", bcdRevision >> 8, bcdRevision & 0xff);
    22222106                        else
    2223                             RTPrintf("UUID:               %s\n"
    2224                                      "VendorId:           %#06x (%04X)\n"
    2225                                      "ProductId:          %#06x (%04X)\n"
    2226                                      "Revision:           %u.%u (%02u%02u)\n",
    2227                                      Utf8Str(id).c_str(),
    2228                                      usVendorId, usVendorId, usProductId, usProductId,
    2229                                      bcdRevision >> 8, bcdRevision & 0xff,
    2230                                      bcdRevision >> 8, bcdRevision & 0xff);
    2231 
    2232                         /* optional stuff. */
    2233                         Bstr bstr;
    2234                         CHECK_ERROR_RET(dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc);
    2235                         if (!bstr.isEmpty())
    2236                         {
    2237                             if (details == VMINFO_MACHINEREADABLE)
    2238                                 RTPrintf("USBAttachedManufacturer%zu=\"%ls\"\n", index + 1, bstr.raw());
    2239                             else
    2240                                 RTPrintf("Manufacturer:       %ls\n", bstr.raw());
    2241                         }
    2242                         CHECK_ERROR_RET(dev, COMGETTER(Product)(bstr.asOutParam()), rc);
    2243                         if (!bstr.isEmpty())
    2244                         {
    2245                             if (details == VMINFO_MACHINEREADABLE)
    2246                                 RTPrintf("USBAttachedProduct%zu=\"%ls\"\n", index + 1, bstr.raw());
    2247                             else
    2248                                 RTPrintf("Product:            %ls\n", bstr.raw());
    2249                         }
    2250                         CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc);
    2251                         if (!bstr.isEmpty())
    2252                         {
    2253                             if (details == VMINFO_MACHINEREADABLE)
    2254                                 RTPrintf("USBAttachedSerialNumber%zu=\"%ls\"\n", index + 1, bstr.raw());
    2255                             else
    2256                                 RTPrintf("SerialNumber:       %ls\n", bstr.raw());
    2257                         }
    2258                         CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), rc);
    2259                         if (!bstr.isEmpty())
    2260                         {
    2261                             if (details == VMINFO_MACHINEREADABLE)
    2262                                 RTPrintf("USBAttachedAddress%zu=\"%ls\"\n", index + 1, bstr.raw());
    2263                             else
    2264                                 RTPrintf("Address:            %ls\n", bstr.raw());
    2265                         }
     2107                            RTStrPrintf(szValue, sizeof(szValue), "%u.%u (%02u%02u)\n",
     2108                                        bcdRevision >> 8, bcdRevision & 0xff, bcdRevision >> 8, bcdRevision & 0xff);
     2109                        SHOW_UTF8_STRING(FmtNm(szNm, "%sRevision%zu", pszPfx, i + 1), "Revision:", szValue);
     2110
     2111                        SHOW_STRING_PROP_NOT_EMPTY(dev, Manufacturer, FmtNm(szNm, "%sManufacturer%zu", pszPfx, i + 1), "Manufacturer:");
     2112                        SHOW_STRING_PROP_NOT_EMPTY(dev, Product,      FmtNm(szNm, "%sProduct%zu", pszPfx, i + 1),      "Product:");
     2113                        SHOW_STRING_PROP_NOT_EMPTY(dev, SerialNumber, FmtNm(szNm, "%sSerialNumber%zu", pszPfx, i + 1), "SerialNumber:");
     2114                        SHOW_STRING_PROP_NOT_EMPTY(dev, Address,      FmtNm(szNm, "%sAddress%zu", pszPfx, i + 1),      "Address:");
    22662115
    22672116                        if (details != VMINFO_MACHINEREADABLE)
     
    23302179     */
    23312180    if (details != VMINFO_MACHINEREADABLE)
    2332         RTPrintf("Shared folders:  ");
     2181        RTPrintf("Shared folders:");
    23332182    uint32_t numSharedFolders = 0;
    23342183#if 0 // not yet implemented
     
    23672216            if (details == VMINFO_MACHINEREADABLE)
    23682217            {
    2369                 RTPrintf("SharedFolderNameMachineMapping%zu=\"%ls\"\n", i + 1,
    2370                          name.raw());
    2371                 RTPrintf("SharedFolderPathMachineMapping%zu=\"%ls\"\n", i + 1,
    2372                          hostPath.raw());
     2218                outputMachineReadableString(FmtNm(szNm, "SharedFolderNameMachineMapping%zu", i + 1), &name);
     2219                outputMachineReadableString(FmtNm(szNm, "SharedFolderPathMachineMapping%zu", i + 1), &hostPath);
    23732220            }
    23742221            else
     
    23962243            if (details == VMINFO_MACHINEREADABLE)
    23972244            {
    2398                 RTPrintf("SharedFolderNameTransientMapping%zu=\"%ls\"\n", i + 1,
    2399                          name.raw());
    2400                 RTPrintf("SharedFolderPathTransientMapping%zu=\"%ls\"\n", i + 1,
    2401                          hostPath.raw());
     2245                outputMachineReadableString(FmtNm(szNm, "SharedFolderNameTransientMapping%zu", i + 1), &name);
     2246                outputMachineReadableString(FmtNm(szNm, "SharedFolderPathTransientMapping%zu", i + 1), &hostPath);
    24022247            }
    24032248            else
     
    24182263        ComPtr<IVRDEServerInfo> vrdeServerInfo;
    24192264        CHECK_ERROR_RET(pConsole, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);
    2420         BOOL    Active = FALSE;
    2421         ULONG   NumberOfClients = 0;
     2265        BOOL    fActive = FALSE;
     2266        ULONG   cNumberOfClients = 0;
    24222267        LONG64  BeginTime = 0;
    24232268        LONG64  EndTime = 0;
     
    24352280        if (!vrdeServerInfo.isNull())
    24362281        {
    2437             CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(Active)(&Active), rc);
    2438             CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(NumberOfClients)(&NumberOfClients), rc);
     2282            CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(Active)(&fActive), rc);
     2283            CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(NumberOfClients)(&cNumberOfClients), rc);
    24392284            CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(BeginTime)(&BeginTime), rc);
    24402285            CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(EndTime)(&EndTime), rc);
     
    24512296        }
    24522297
    2453         if (details == VMINFO_MACHINEREADABLE)
    2454             RTPrintf("VRDEActiveConnection=\"%s\"\n", Active ? "on": "off");
    2455         else
    2456             RTPrintf("VRDE Connection:    %s\n", Active? "active": "not active");
    2457 
    2458         if (details == VMINFO_MACHINEREADABLE)
    2459             RTPrintf("VRDEClients=%d\n", NumberOfClients);
    2460         else
    2461             RTPrintf("Clients so far:     %d\n", NumberOfClients);
    2462 
    2463         if (NumberOfClients > 0)
    2464         {
    2465             char timestr[128];
    2466 
    2467             if (Active)
    2468             {
    2469                 makeTimeStr(timestr, sizeof(timestr), BeginTime);
    2470                 if (details == VMINFO_MACHINEREADABLE)
    2471                     RTPrintf("VRDEStartTime=\"%s\"\n", timestr);
    2472                 else
    2473                     RTPrintf("Start time:         %s\n", timestr);
    2474             }
     2298        SHOW_BOOL_VALUE_EX("VRDEActiveConnection", "VRDE Connection:", fActive, "active", "not active");
     2299        SHOW_ULONG_VALUE("VRDEClients=", "Clients so far:", cNumberOfClients, "");
     2300
     2301        if (cNumberOfClients > 0)
     2302        {
     2303            char szTimeValue[128];
     2304            makeTimeStr(szTimeValue, sizeof(szTimeValue), BeginTime);
     2305            if (fActive)
     2306                SHOW_UTF8_STRING("VRDEStartTime", "Start time:", szTimeValue);
    24752307            else
    24762308            {
    2477                 makeTimeStr(timestr, sizeof(timestr), BeginTime);
    2478                 if (details == VMINFO_MACHINEREADABLE)
    2479                     RTPrintf("VRDELastStartTime=\"%s\"\n", timestr);
    2480                 else
    2481                     RTPrintf("Last started:       %s\n", timestr);
    2482                 makeTimeStr(timestr, sizeof(timestr), EndTime);
    2483                 if (details == VMINFO_MACHINEREADABLE)
    2484                     RTPrintf("VRDELastEndTime=\"%s\"\n", timestr);
    2485                 else
    2486                     RTPrintf("Last ended:         %s\n", timestr);
     2309                SHOW_UTF8_STRING("VRDELastStartTime", "Last started:", szTimeValue);
     2310                makeTimeStr(szTimeValue, sizeof(szTimeValue), EndTime);
     2311                SHOW_UTF8_STRING("VRDELastEndTime", "Last ended:", szTimeValue);
    24872312            }
    24882313
     
    24942319                ThroughputReceive = (BytesReceived * 1000) / (EndTime - BeginTime);
    24952320            }
    2496 
    2497             if (details == VMINFO_MACHINEREADABLE)
    2498             {
    2499                 RTPrintf("VRDEBytesSent=%lld\n", BytesSent);
    2500                 RTPrintf("VRDEThroughputSend=%lld\n", ThroughputSend);
    2501                 RTPrintf("VRDEBytesSentTotal=%lld\n", BytesSentTotal);
    2502 
    2503                 RTPrintf("VRDEBytesReceived=%lld\n", BytesReceived);
    2504                 RTPrintf("VRDEThroughputReceive=%lld\n", ThroughputReceive);
    2505                 RTPrintf("VRDEBytesReceivedTotal=%lld\n", BytesReceivedTotal);
    2506             }
    2507             else
    2508             {
    2509                 RTPrintf("Sent:               %lld Bytes\n", BytesSent);
    2510                 RTPrintf("Average speed:      %lld B/s\n", ThroughputSend);
    2511                 RTPrintf("Sent total:         %lld Bytes\n", BytesSentTotal);
    2512 
    2513                 RTPrintf("Received:           %lld Bytes\n", BytesReceived);
    2514                 RTPrintf("Speed:              %lld B/s\n", ThroughputReceive);
    2515                 RTPrintf("Received total:     %lld Bytes\n", BytesReceivedTotal);
    2516             }
    2517 
    2518             if (Active)
    2519             {
    2520                 if (details == VMINFO_MACHINEREADABLE)
    2521                 {
    2522                     RTPrintf("VRDEUserName=\"%ls\"\n", User.raw());
    2523                     RTPrintf("VRDEDomain=\"%ls\"\n", Domain.raw());
    2524                     RTPrintf("VRDEClientName=\"%ls\"\n", ClientName.raw());
    2525                     RTPrintf("VRDEClientIP=\"%ls\"\n", ClientIP.raw());
    2526                     RTPrintf("VRDEClientVersion=%d\n",  ClientVersion);
    2527                     RTPrintf("VRDEEncryption=\"%s\"\n", EncryptionStyle == 0? "RDP4": "RDP5 (X.509)");
    2528                 }
    2529                 else
    2530                 {
    2531                     RTPrintf("User name:          %ls\n", User.raw());
    2532                     RTPrintf("Domain:             %ls\n", Domain.raw());
    2533                     RTPrintf("Client name:        %ls\n", ClientName.raw());
    2534                     RTPrintf("Client IP:          %ls\n", ClientIP.raw());
    2535                     RTPrintf("Client version:     %d\n",  ClientVersion);
    2536                     RTPrintf("Encryption:         %s\n", EncryptionStyle == 0? "RDP4": "RDP5 (X.509)");
    2537                 }
     2321            SHOW_LONG64_VALUE("VRDEBytesSent", "Sent:", BytesSent, "Bytes");
     2322            SHOW_LONG64_VALUE("VRDEThroughputSend", "Average speed:", ThroughputSend, "B/s");
     2323            SHOW_LONG64_VALUE("VRDEBytesSentTotal", "Sent total:", BytesSentTotal, "Bytes");
     2324
     2325            SHOW_LONG64_VALUE("VRDEBytesReceived", "Received:", BytesReceived, "Bytes");
     2326            SHOW_LONG64_VALUE("VRDEThroughputReceive", "Speed:", ThroughputReceive, "B/s");
     2327            SHOW_LONG64_VALUE("VRDEBytesReceivedTotal", "Received total:", BytesReceivedTotal, "Bytes");
     2328
     2329            if (fActive)
     2330            {
     2331                SHOW_BSTR_STRING("VRDEUserName", "User name:", User);
     2332                SHOW_BSTR_STRING("VRDEDomain", "Domain:", Domain);
     2333                SHOW_BSTR_STRING("VRDEClientName", "Client name:", ClientName);
     2334                SHOW_BSTR_STRING("VRDEClientIP", "Client IP:", ClientIP);
     2335                SHOW_ULONG_VALUE("VRDEClientVersion", "Client version:", ClientVersion, "");
     2336                SHOW_UTF8_STRING("VRDEEncryption", "Encryption:", EncryptionStyle == 0 ? "RDP4" : "RDP5 (X.509)");
    25382337            }
    25392338        }
     
    25842383        }
    25852384
    2586         if (details == VMINFO_MACHINEREADABLE)
    2587         {
    2588             RTPrintf("videocap=\"%s\"\n",       fCaptureVideo ? "on" : "off");
     2385        SHOW_BOOL_VALUE_EX("videocap", "Capturing:", fCaptureVideo, "active", "not active");
    25892386# ifdef VBOX_WITH_AUDIO_VIDEOREC
    2590             RTPrintf("videocap_audio=\"%s\"\n", fCaptureAudio ? "on" : "off");
     2387        SHOW_BOOL_VALUE_EX("videocapaudio", "Capture audio:", fCaptureAudio, "active", "not active");
    25912388# endif
    2592             RTPrintf("videocapscreens=");
    2593             bool fComma = false;
    2594             for (unsigned i = 0; i < screens.size(); i++)
    2595                 if (screens[i])
    2596                 {
    2597                     RTPrintf("%s%u", fComma ? "," : "", i);
    2598                     fComma = true;
    2599                 }
     2389        szValue[0] = '\0';
     2390        for (size_t i = 0, off = 0; i < screens.size(); i++)
     2391            if (screens[i] && off < sizeof(szValue) - 3)
     2392                off += RTStrPrintf(&szValue[off], sizeof(szValue) - off, off ? ",%zu" : "%zu", i);
     2393        SHOW_UTF8_STRING("videocapscreens", "Capture screens:", szValue);
     2394        SHOW_BSTR_STRING("videocapfile", "Capture file:", bstrFile);
     2395        RTStrPrintf(szValue, sizeof(szValue), "%ux%u", Width, Height);
     2396        SHOW_UTF8_STRING("videocapres", "Capture dimensions:", szValue);
     2397        SHOW_ULONG_VALUE("videocaprate", "Capture rate:", Rate, "kbps");
     2398        SHOW_ULONG_VALUE("videocapfps", "Capture FPS:", Fps, "kbps");
     2399        SHOW_BSTR_STRING("videocapopts", "Capture options:", bstrOptions);
     2400
     2401        if (details != VMINFO_MACHINEREADABLE)
    26002402            RTPrintf("\n");
    2601             RTPrintf("videocapfile=\"%ls\"\n", bstrFile.raw());
    2602             RTPrintf("videocapres=%ux%u\n", (unsigned)Width, (unsigned)Height);
    2603             RTPrintf("videocaprate=%u\n", (unsigned)Rate);
    2604             RTPrintf("videocapfps=%u\n", (unsigned)Fps);
    2605             RTPrintf("videocapopts=%ls\n", bstrOptions.raw());
    2606         }
    2607         else
    2608         {
    2609             RTPrintf("Capturing:          %s\n", fCaptureVideo ? "active" : "not active");
    2610 # ifdef VBOX_WITH_AUDIO_VIDEOREC
    2611             RTPrintf("Capture audio:      %s\n", fCaptureAudio ? "active" : "not active");
    2612 # endif
    2613             RTPrintf("Capture screens:    ");
    2614             bool fComma = false;
    2615             for (unsigned i = 0; i < screens.size(); i++)
    2616                 if (screens[i])
    2617                 {
    2618                     RTPrintf("%s%u", fComma ? "," : "", i);
    2619                     fComma = true;
    2620                 }
    2621             RTPrintf("\n");
    2622             RTPrintf("Capture file:       %ls\n", bstrFile.raw());
    2623             RTPrintf("Capture dimensions: %ux%u\n", Width, Height);
    2624             RTPrintf("Capture rate:       %u kbps\n", Rate);
    2625             RTPrintf("Capture FPS:        %u\n", Fps);
    2626             RTPrintf("Capture options:    %ls\n", bstrOptions.raw());
    2627             RTPrintf("\n");
    2628 
    2629             /** @todo Add more audio capturing profile / information here. */
    2630         }
     2403        /** @todo Add more audio capturing profile / information here. */
    26312404    }
    26322405#endif /* VBOX_WITH_VIDEOREC */
     
    26502423        RTPrintf("Guest:\n\n");
    26512424
    2652     ULONG guestVal;
    2653     rc = machine->COMGETTER(MemoryBalloonSize)(&guestVal);
    2654     if (SUCCEEDED(rc))
    2655     {
    2656         if (details == VMINFO_MACHINEREADABLE)
    2657             RTPrintf("GuestMemoryBalloon=%d\n", guestVal);
    2658         else
    2659             RTPrintf("Configured memory balloon size:      %d MB\n", guestVal);
    2660     }
     2425    SHOW_ULONG_PROP(machine, MemoryBalloonSize, "GuestMemoryBalloon", "Configured memory balloon size:", "MB");
    26612426
    26622427    if (pConsole)
     
    26662431        if (SUCCEEDED(rc) && !guest.isNull())
    26672432        {
    2668             Bstr guestString;
    2669             rc = guest->COMGETTER(OSTypeId)(guestString.asOutParam());
    2670             if (   SUCCEEDED(rc)
    2671                 && !guestString.isEmpty())
    2672             {
    2673                 if (details == VMINFO_MACHINEREADABLE)
    2674                     RTPrintf("GuestOSType=\"%ls\"\n", guestString.raw());
    2675                 else
    2676                     RTPrintf("OS type:                             %ls\n", guestString.raw());
    2677             }
     2433            SHOW_STRING_PROP_NOT_EMPTY(guest, OSTypeId, "GuestOSType", "OS type:");
    26782434
    26792435            AdditionsRunLevelType_T guestRunLevel; /** @todo Add a runlevel-to-string (e.g. 0 = "None") method? */
    26802436            rc = guest->COMGETTER(AdditionsRunLevel)(&guestRunLevel);
    26812437            if (SUCCEEDED(rc))
    2682             {
    2683                 if (details == VMINFO_MACHINEREADABLE)
    2684                     RTPrintf("GuestAdditionsRunLevel=%u\n", guestRunLevel);
    2685                 else
    2686                     RTPrintf("Additions run level:                 %u\n", guestRunLevel);
    2687             }
    2688 
     2438                SHOW_ULONG_VALUE("GuestAdditionsRunLevel", "Additions run level:", (ULONG)guestRunLevel, "");
     2439
     2440            Bstr guestString;
    26892441            rc = guest->COMGETTER(AdditionsVersion)(guestString.asOutParam());
    26902442            if (   SUCCEEDED(rc)
     
    26952447                if (FAILED(rc))
    26962448                    uRevision = 0;
    2697 
    2698                 if (details == VMINFO_MACHINEREADABLE)
    2699                     RTPrintf("GuestAdditionsVersion=\"%ls r%u\"\n", guestString.raw(), uRevision);
    2700                 else
    2701                     RTPrintf("Additions version:                   %ls r%u\n\n", guestString.raw(), uRevision);
     2449                RTStrPrintf(szValue, sizeof(szValue), "%ls r%u", guestString.raw(), uRevision);
     2450                SHOW_UTF8_STRING("GuestAdditionsVersion", "Additions version", szValue);
    27022451            }
    27032452
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette