Changeset 70717 in vbox
- Timestamp:
- Jan 23, 2018 6:54:16 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120461
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r70587 r70717 221 221 * 222 222 * @param pszName The variable name. 223 * @param pszValue The value. 224 */ 225 static 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. 223 260 * @param pbstrValue The value. 224 261 */ 225 262 static void outputMachineReadableString(const char *pszName, Bstr const *pbstrValue) 226 263 { 227 Assert(strpbrk(pszName, "\"\\") == NULL);228 229 264 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()); 252 266 } 253 267 … … 392 406 } 393 407 408 /** 409 * Helper for formatting an indexed name or some such thing. 410 */ 411 static 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 394 420 395 421 /* Disable global optimizations for MSC 8.0/64 to make it compile in reasonable … … 415 441 pSession->COMGETTER(Console)(pConsole.asOutParam()); 416 442 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) \ 421 500 do \ 422 501 { \ … … 424 503 CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&f), hrcCheck); \ 425 504 if (details == VMINFO_MACHINEREADABLE) \ 426 RTPrintf( a_szMachine "=\"%s\"\n", f ? "on" : "off"); \505 outputMachineReadableString(a_pszMachine, f ? "on" : "off"); \ 427 506 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); \ 429 508 } while (0) 430 509 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) \ 432 511 do \ 433 512 { \ … … 435 514 CHECK_ERROR2I_RET(a_pObj, a_Invocation, hrcCheck); \ 436 515 if (details == VMINFO_MACHINEREADABLE) \ 437 RTPrintf( a_szMachine "=\"%s\"\n", f ? "on" : "off"); \516 outputMachineReadableString(a_pszMachine, f ? "on" : "off"); \ 438 517 else \ 439 RTPrintf("%- 16s %s\n", a_szHuman ":", f ? "on" : "off"); \518 RTPrintf("%-28s %s\n", a_pszHuman, f ? "enabled" : "disabled"); \ 440 519 } while (0) 441 520 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) \ 443 522 do \ 444 523 { \ … … 446 525 CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \ 447 526 if (details == VMINFO_MACHINEREADABLE) \ 448 outputMachineReadableString(a_ szMachine, &bstr); \527 outputMachineReadableString(a_pszMachine, &bstr); \ 449 528 else \ 450 RTPrintf("%- 16s %ls\n", a_szHuman ":", bstr.raw()); \529 RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \ 451 530 } while (0) 452 531 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) \ 456 533 do \ 457 534 { \ 458 535 Bstr bstr; \ 459 536 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)) \ 461 554 { \ 462 555 if (details == VMINFO_MACHINEREADABLE)\ 463 outputMachineReadableString(a_ szMachine, &bstr); \556 outputMachineReadableString(a_pszMachine, &bstr); \ 464 557 else \ 465 RTPrintf("%- 16s %ls\n", a_szHuman ":", bstr.raw()); \558 RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \ 466 559 } \ 467 560 } while (0) 468 561 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) \ 470 563 do \ 471 564 { \ … … 481 574 Bstr bstr(str); \ 482 575 if (details == VMINFO_MACHINEREADABLE) \ 483 outputMachineReadableString(a_ szMachine, &bstr); \576 outputMachineReadableString(a_pszMachine, &bstr); \ 484 577 else \ 485 RTPrintf("%- 16s %ls\n", a_szHuman ":", bstr.raw()); \578 RTPrintf("%-28s %ls\n", a_pszHuman, bstr.raw()); \ 486 579 } while (0) 487 580 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_U LONG_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) \ 492 585 do \ 493 586 { \ 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; \ 495 599 CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&u32), hrcCheck); \ 496 600 if (details == VMINFO_MACHINEREADABLE) \ 497 RTPrintf( a_szMachine "=%u\n", u32); \601 RTPrintf("%s=%u\n", a_pszMachine, u32); \ 498 602 else \ 499 RTPrintf("%- 16s %u" a_szUnit "\n", a_szHuman ":", u32); \603 RTPrintf("%-28s %u%s\n", a_pszHuman, u32, a_pszUnit); \ 500 604 } while (0) 501 605 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) \ 503 607 do \ 504 608 { \ 505 LONG64 i64 ; \609 LONG64 i64 = 0; \ 506 610 CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(&i64), hrcCheck); \ 507 611 if (details == VMINFO_MACHINEREADABLE) \ 508 RTPrintf( a_szMachine "=%lld\n", i64); \612 RTPrintf("%s=%lld\n", a_pszMachine, i64); \ 509 613 else \ 510 RTPrintf("%- 16s %'lld" a_szUnit "\n", a_szHuman ":", i64); \614 RTPrintf("%-28s %'lld%s\n", a_pszHuman, i64, a_pszUnit); \ 511 615 } while (0) 512 616 … … 568 672 } 569 673 570 SHOW_STRING_PROP( machine, Name, "name", "Name ");674 SHOW_STRING_PROP( machine, Name, "name", "Name:"); 571 675 572 676 Bstr osTypeId; … … 574 678 ComPtr<IGuestOSType> osType; 575 679 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:"); 583 687 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); 589 693 590 694 ChipsetType_T chipsetType; … … 598 702 default: AssertFailed(); pszChipsetType = "unknown"; break; 599 703 } 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); 604 705 605 706 FirmwareType_T firmwareType; … … 615 716 default: AssertFailed(); pszFirmwareType = "unknown"; break; 616 717 } 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:", ""); 629 728 630 729 if (details != VMINFO_MACHINEREADABLE) 631 RTPrintf(" CPUID overrides:");730 RTPrintf("%-28s ", "CPUID overrides:"); 632 731 ULONG uOrdinal = 0; 633 732 for (uOrdinal = 0; uOrdinal < _4K; uOrdinal++) … … 642 741 { 643 742 if (!uOrdinal) 644 RTPrintf("Leaf no. 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); 646 745 } 647 746 } … … 653 752 } 654 753 } 655 656 754 if (!uOrdinal && details != VMINFO_MACHINEREADABLE) 657 755 RTPrintf("None\n"); … … 680 778 pszBootMenu = "message and menu"; 681 779 } 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); 686 781 687 782 ComPtr<ISystemProperties> systemProperties; … … 693 788 DeviceType_T bootOrder; 694 789 CHECK_ERROR2I_RET(machine, GetBootOrder(i, &bootOrder), hrcCheck); 790 const char *pszDevice; 695 791 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"; 702 793 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"; 709 795 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"; 716 797 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"; 723 799 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"; 730 801 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"; 737 803 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:"); 748 810 749 811 APICMode_T apicMode; … … 769 831 break; 770 832 } 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.:"); 783 842 784 843 ParavirtProvider_T paravirtProvider; 785 844 CHECK_ERROR2I_RET(machine, COMGETTER(ParavirtProvider)(¶virtProvider), hrcCheck); 786 845 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); 791 847 792 848 ParavirtProvider_T effParavirtProvider; 793 849 CHECK_ERROR2I_RET(machine, GetEffectiveParavirtProvider(&effParavirtProvider), hrcCheck); 794 850 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); 799 852 800 853 Bstr paravirtDebug; 801 854 CHECK_ERROR2I_RET(machine, COMGETTER(ParavirtDebug)(paravirtDebug.asOutParam()), hrcCheck); 802 855 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); 809 857 810 858 MachineState_T machineState; … … 829 877 } 830 878 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:"); 835 883 #ifdef VBOX_WITH_VIDEOHWACCEL 836 SHOW_BOOLEAN_PROP( machine, Accelerate2DVideoEnabled, "accelerate2dvideo", "2D Video Acceleration ");884 SHOW_BOOLEAN_PROP( machine, Accelerate2DVideoEnabled, "accelerate2dvideo", "2D Video Acceleration:"); 837 885 #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:"); 848 896 849 897 /** @todo Convert the remainder of the function to SHOW_XXX macros and add error … … 1044 1092 if (SUCCEEDED(rc) && nic) 1045 1093 { 1094 FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "nic%u" : "NIC %u:", currentNIC + 1); 1095 1046 1096 BOOL fEnabled; 1047 1097 nic->COMGETTER(Enabled)(&fEnabled); … … 1049 1099 { 1050 1100 if (details == VMINFO_MACHINEREADABLE) 1051 RTPrintf(" nic%d=\"none\"\n", currentNIC + 1);1101 RTPrintf("%s=\"none\"\n", szNm); 1052 1102 else 1053 RTPrintf(" NIC %d: disabled\n", currentNIC + 1);1103 RTPrintf("%-28s disabled\n", szNm); 1054 1104 } 1055 1105 else … … 1326 1376 } 1327 1377 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(), 1330 1380 fConnected ? "on" : "off", 1331 1381 fTraceEnabled ? "on" : "off", … … 1378 1428 break; 1379 1429 } 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); 1384 1431 1385 1432 /* Keyboard device information */ … … 1409 1456 break; 1410 1457 } 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); 1415 1459 1416 1460 ComPtr<ISystemProperties> sysProps; … … 1426 1470 if (SUCCEEDED(rc) && uart) 1427 1471 { 1472 FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "uart%u" : "UART %u:", currentUART + 1); 1473 1428 1474 /* show the config of this UART */ 1429 1475 BOOL fEnabled; … … 1432 1478 { 1433 1479 if (details == VMINFO_MACHINEREADABLE) 1434 RTPrintf(" uart%d=\"off\"\n", currentUART + 1);1480 RTPrintf("%s=\"off\"\n", szNm); 1435 1481 else 1436 RTPrintf(" UART %d: disabled\n", currentUART + 1);1482 RTPrintf("%-28s disabled\n", szNm); 1437 1483 } 1438 1484 else … … 1449 1495 1450 1496 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); 1453 1498 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); 1456 1500 switch (HostMode) 1457 1501 { … … 1508 1552 if (SUCCEEDED(rc) && lpt) 1509 1553 { 1554 FmtNm(szNm, details == VMINFO_MACHINEREADABLE ? "lpt%u" : "LPT %u:", currentLPT + 1); 1555 1510 1556 /* show the config of this LPT */ 1511 1557 BOOL fEnabled; … … 1514 1560 { 1515 1561 if (details == VMINFO_MACHINEREADABLE) 1516 RTPrintf(" lpt%d=\"off\"\n", currentLPT + 1);1562 RTPrintf("%s=\"off\"\n", szNm); 1517 1563 else 1518 RTPrintf(" LPT %d: disabled\n", currentLPT + 1);1564 RTPrintf("%-28s disabled\n", szNm); 1519 1565 } 1520 1566 else … … 1527 1573 1528 1574 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); 1531 1576 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); 1534 1578 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()); 1537 1580 else 1538 1581 RTPrintf(", attached to device '%ls'\n", path.raw()); … … 1657 1700 fEnabled = FALSE; 1658 1701 1659 BOOL fEnabledIn = false;1660 CHECK_ERROR(AudioAdapter, COMGETTER(EnabledIn)(&fEnabledIn));1661 1662 BOOL fEnabledOut = false;1663 CHECK_ERROR(AudioAdapter, COMGETTER(EnabledOut)(&fEnabledOut));1664 1665 1702 if (details == VMINFO_MACHINEREADABLE) 1666 { 1703 RTPrintf("audio=\"%s\"\n", fEnabled ? pszDrv : "none"); 1704 else 1705 { 1706 RTPrintf("%-28s %s", "Audio:", fEnabled ? "enabled" : "disabled"); 1667 1707 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); 1682 1709 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:"); 1687 1713 } 1688 1714 1689 1715 /* Shared clipboard */ 1690 1716 { 1691 const char *psz = "Unknown";1692 ClipboardMode_T enmMode ;1717 const char *psz; 1718 ClipboardMode_T enmMode = (ClipboardMode_T)0; 1693 1719 rc = machine->COMGETTER(ClipboardMode)(&enmMode); 1694 1720 switch (enmMode) 1695 1721 { 1696 1722 case ClipboardMode_Disabled: 1697 if (details == VMINFO_MACHINEREADABLE) 1698 psz = "disabled"; 1699 else 1700 psz = "disabled"; 1723 psz = "disabled"; 1701 1724 break; 1702 1725 case ClipboardMode_HostToGuest: 1703 if (details == VMINFO_MACHINEREADABLE) 1704 psz = "hosttoguest"; 1705 else 1706 psz = "HostToGuest"; 1726 psz = details == VMINFO_MACHINEREADABLE ? "hosttoguest" : "HostToGuest"; 1707 1727 break; 1708 1728 case ClipboardMode_GuestToHost: 1709 if (details == VMINFO_MACHINEREADABLE) 1710 psz = "guesttohost"; 1711 else 1712 psz = "GuestToHost"; 1729 psz = details == VMINFO_MACHINEREADABLE ? "guesttohost" : "GuestToHost"; 1713 1730 break; 1714 1731 case ClipboardMode_Bidirectional: 1715 if (details == VMINFO_MACHINEREADABLE) 1716 psz = "bidirectional"; 1717 else 1718 psz = "Bidirectional"; 1732 psz = details == VMINFO_MACHINEREADABLE ? "bidirectional" : "Bidirectional"; 1719 1733 break; 1720 1734 default: 1721 if (details == VMINFO_MACHINEREADABLE) 1722 psz = "unknown"; 1735 psz = details == VMINFO_MACHINEREADABLE ? "unknown" : "Unknown"; 1723 1736 break; 1724 1737 } 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); 1729 1739 } 1730 1740 1731 1741 /* Drag and drop */ 1732 1742 { 1733 const char *psz = "Unknown";1743 const char *psz; 1734 1744 DnDMode_T enmMode; 1735 1745 rc = machine->COMGETTER(DnDMode)(&enmMode); … … 1737 1747 { 1738 1748 case DnDMode_Disabled: 1739 if (details == VMINFO_MACHINEREADABLE) 1740 psz = "disabled"; 1741 else 1742 psz = "disabled"; 1749 psz = "disabled"; 1743 1750 break; 1744 1751 case DnDMode_HostToGuest: 1745 if (details == VMINFO_MACHINEREADABLE) 1746 psz = "hosttoguest"; 1747 else 1748 psz = "HostToGuest"; 1752 psz = details == VMINFO_MACHINEREADABLE ? "hosttoguest" : "HostToGuest"; 1749 1753 break; 1750 1754 case DnDMode_GuestToHost: 1751 if (details == VMINFO_MACHINEREADABLE) 1752 psz = "guesttohost"; 1753 else 1754 psz = "GuestToHost"; 1755 psz = details == VMINFO_MACHINEREADABLE ? "guesttohost" : "GuestToHost"; 1755 1756 break; 1756 1757 case DnDMode_Bidirectional: 1757 if (details == VMINFO_MACHINEREADABLE) 1758 psz = "bidirectional"; 1759 else 1760 psz = "Bidirectional"; 1758 psz = details == VMINFO_MACHINEREADABLE ? "bidirectional" : "Bidirectional"; 1761 1759 break; 1762 1760 default: 1763 if (details == VMINFO_MACHINEREADABLE) 1764 psz = "unknown"; 1761 psz = details == VMINFO_MACHINEREADABLE ? "unknown" : "Unknown"; 1765 1762 break; 1766 1763 } 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); 1771 1765 } 1772 1766 … … 1779 1773 rc = machine->COMGETTER(SessionName)(sessName.asOutParam()); 1780 1774 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); 1787 1776 } 1788 1777 } … … 1825 1814 default: break; 1826 1815 } 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); 1828 1817 } 1829 1818 } … … 1911 1900 if (address.isEmpty()) 1912 1901 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); 1914 1904 if (pConsole && currentPort != -1 && currentPort != 0) 1915 RTPrintf(" VRDE port: %d\n", currentPort);1905 RTPrintf("%-28s %d\n", "VRDE port:", currentPort); 1916 1906 if (fVideoChannel) 1917 RTPrintf(" Video redirection: enabled (Quality %ls)\n", videoChannelQuality.raw());1907 RTPrintf("%-28s enabled (Quality %ls)\n", "Video redirection:", videoChannelQuality.raw()); 1918 1908 else 1919 RTPrintf(" Video redirection: disabled\n");1909 RTPrintf("%-28s disabled\n", "Video redirection:"); 1920 1910 } 1921 1911 com::SafeArray<BSTR> aProperties; … … 1937 1927 { 1938 1928 if (value.isEmpty()) 1939 RTPrintf(" VRDE property: %-10lS = <not set>\n", aProperties[i]);1929 RTPrintf("%-28s: %-10lS = <not set>\n", "VRDE property", aProperties[i]); 1940 1930 else 1941 RTPrintf(" VRDE property: %-10lS = \"%ls\"\n", aProperties[i], value.raw());1931 RTPrintf("%-28s: %-10lS = \"%ls\"\n", "VRDE property", aProperties[i], value.raw()); 1942 1932 } 1943 1933 } … … 1949 1939 RTPrintf("vrde=\"off\"\n"); 1950 1940 else 1951 RTPrintf(" VRDE: disabled\n");1941 RTPrintf("%-28s disabled\n", "VRDE:"); 1952 1942 } 1953 1943 } … … 1988 1978 } 1989 1979 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); 2004 1983 } 2005 1984 … … 2026 2005 ComPtr<IUSBDeviceFilter> DevPtr = Coll[index]; 2027 2006 2028 /* Query info. */2029 2030 2007 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:"); 2081 2018 if (details != VMINFO_MACHINEREADABLE) 2082 2019 { … … 2084 2021 CHECK_ERROR_RET(DevPtr, COMGETTER(MaskedInterfaces)(&fMaskedIfs), rc); 2085 2022 if (fMaskedIfs) 2086 RTPrintf(" Masked Interfaces: %#010x\n", fMaskedIfs);2023 RTPrintf("%-28s %#010x\n", "Masked Interfaces:", fMaskedIfs); 2087 2024 RTPrintf("\n"); 2088 2025 } … … 2108 2045 else 2109 2046 { 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) 2111 2050 { 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 2121 2057 USHORT bcdRevision; 2122 2058 CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), rc); 2123 2124 2059 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); 2133 2061 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:"); 2177 2070 2178 2071 if (details != VMINFO_MACHINEREADABLE) … … 2197 2090 else 2198 2091 { 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) 2200 2095 { 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 2210 2102 USHORT bcdRevision; 2211 2103 CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), rc); 2212 2213 2104 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); 2222 2106 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:"); 2266 2115 2267 2116 if (details != VMINFO_MACHINEREADABLE) … … 2330 2179 */ 2331 2180 if (details != VMINFO_MACHINEREADABLE) 2332 RTPrintf("Shared folders: 2181 RTPrintf("Shared folders:"); 2333 2182 uint32_t numSharedFolders = 0; 2334 2183 #if 0 // not yet implemented … … 2367 2216 if (details == VMINFO_MACHINEREADABLE) 2368 2217 { 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); 2373 2220 } 2374 2221 else … … 2396 2243 if (details == VMINFO_MACHINEREADABLE) 2397 2244 { 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); 2402 2247 } 2403 2248 else … … 2418 2263 ComPtr<IVRDEServerInfo> vrdeServerInfo; 2419 2264 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; 2422 2267 LONG64 BeginTime = 0; 2423 2268 LONG64 EndTime = 0; … … 2435 2280 if (!vrdeServerInfo.isNull()) 2436 2281 { 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); 2439 2284 CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(BeginTime)(&BeginTime), rc); 2440 2285 CHECK_ERROR_RET(vrdeServerInfo, COMGETTER(EndTime)(&EndTime), rc); … … 2451 2296 } 2452 2297 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); 2475 2307 else 2476 2308 { 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); 2487 2312 } 2488 2313 … … 2494 2319 ThroughputReceive = (BytesReceived * 1000) / (EndTime - BeginTime); 2495 2320 } 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)"); 2538 2337 } 2539 2338 } … … 2584 2383 } 2585 2384 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"); 2589 2386 # 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"); 2591 2388 # 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) 2600 2402 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. */ 2631 2404 } 2632 2405 #endif /* VBOX_WITH_VIDEOREC */ … … 2650 2423 RTPrintf("Guest:\n\n"); 2651 2424 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"); 2661 2426 2662 2427 if (pConsole) … … 2666 2431 if (SUCCEEDED(rc) && !guest.isNull()) 2667 2432 { 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:"); 2678 2434 2679 2435 AdditionsRunLevelType_T guestRunLevel; /** @todo Add a runlevel-to-string (e.g. 0 = "None") method? */ 2680 2436 rc = guest->COMGETTER(AdditionsRunLevel)(&guestRunLevel); 2681 2437 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; 2689 2441 rc = guest->COMGETTER(AdditionsVersion)(guestString.asOutParam()); 2690 2442 if ( SUCCEEDED(rc) … … 2695 2447 if (FAILED(rc)) 2696 2448 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); 2702 2451 } 2703 2452
Note:
See TracChangeset
for help on using the changeset viewer.