Changeset 4779 in vbox for trunk/src/VBox
- Timestamp:
- Sep 13, 2007 5:48:46 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r4685 r4779 279 279 " [-details]\n" 280 280 " [-statistics]\n" 281 " [-machinereadable]\n" 281 282 "\n"); 282 283 } … … 661 662 } 662 663 663 static void showSnapshots(ComPtr<ISnapshot> rootSnapshot, int level = 0)664 static void showSnapshots(ComPtr<ISnapshot> rootSnapshot, VMINFO_DETAILS details, const Bstr &prefix = "", int level = 0) 664 665 { 665 666 /* start with the root */ … … 668 669 rootSnapshot->COMGETTER(Name)(name.asOutParam()); 669 670 rootSnapshot->COMGETTER(Id)(uuid.asOutParam()); 670 /* print with indentation */ 671 RTPrintf("%*sName: %lS (UUID: %s)\n", level * 3, "", name.raw(), uuid.toString().raw()); 671 if (details == VMINFO_MACHINEREADABLE) 672 { 673 /* print with hierarchical numbering */ 674 RTPrintf("SnapshotName%lS=\"%lS\"\n", prefix.raw(), name.raw()); 675 RTPrintf("SnapshotUUID%lS=\"%s\"\n", prefix.raw(), uuid.toString().raw()); 676 } 677 else 678 { 679 /* print with indentation */ 680 RTPrintf(" %lSName: %lS (UUID: %s)\n", prefix.raw(), name.raw(), uuid.toString().raw()); 681 } 672 682 673 683 /* get the children */ … … 678 688 ComPtr<ISnapshotEnumerator> enumerator; 679 689 coll->Enumerate(enumerator.asOutParam()); 690 ULONG index = 0; 680 691 BOOL hasMore = FALSE; 681 692 while (enumerator->HasMore(&hasMore), hasMore) … … 685 696 if (snapshot) 686 697 { 698 Bstr newPrefix; 699 if (details == VMINFO_MACHINEREADABLE) 700 newPrefix = Utf8StrFmt("%lS-%d", prefix.raw(), index + 1); 701 else 702 newPrefix = Utf8StrFmt("%lS ", prefix.raw()); 687 703 /* recursive call */ 688 showSnapshots(snapshot, level + 1); 689 } 704 showSnapshots(snapshot, details, newPrefix, level + 1); 705 } 706 index++; 690 707 } 691 708 } … … 712 729 HRESULT rc; 713 730 731 /* 732 * The rules for output in -argdump format: 733 * 1) the key part (the [0-9a-zA-Z_]+ string before the '=' delimiter) 734 * is all lowercase for "VBoxManage modifyvm" parameters. Any 735 * other values printed are in CamelCase. 736 * 2) strings (anything non-decimal) are printed surrounded by 737 * double quotes '"'. If the strings themselves contain double 738 * quotes, these characters are escaped by '\'. Any '\' character 739 * in the original string is also escaped by '\'. 740 * 3) numbers (containing just [0-9\-]) are written out unchanged. 741 */ 742 743 /** @todo the quoting is not yet implemented! */ 744 714 745 BOOL accessible = FALSE; 715 746 CHECK_ERROR (machine, COMGETTER(Accessible) (&accessible)); … … 718 749 if (!accessible) 719 750 { 720 RTPrintf ("Name: <inaccessible!>\n"); 751 if (details == VMINFO_MACHINEREADABLE) 752 RTPrintf("name=\"<inaccessible>\"\n"); 753 else 754 RTPrintf ("Name: <inaccessible!>\n"); 721 755 Guid uuid; 722 756 rc = machine->COMGETTER(Id) (uuid.asOutParam()); 723 RTPrintf ("UUID: %s\n", uuid.toString().raw()); 724 Bstr settingsFilePath; 725 rc = machine->COMGETTER(SettingsFilePath) (settingsFilePath.asOutParam()); 726 RTPrintf ("Config file: %lS\n", settingsFilePath.raw()); 727 ComPtr<IVirtualBoxErrorInfo> accessError; 728 rc = machine->COMGETTER(AccessError) (accessError.asOutParam()); 729 RTPrintf ("Access error details:\n"); 730 ErrorInfo ei (accessError); 731 ei.print ("[-] "); 732 RTPrintf ("\n"); 757 if (details == VMINFO_MACHINEREADABLE) 758 RTPrintf ("UUID=\"%s\"\n", uuid.toString().raw()); 759 else 760 RTPrintf ("UUID: %s\n", uuid.toString().raw()); 761 if (details != VMINFO_MACHINEREADABLE) 762 { 763 Bstr settingsFilePath; 764 rc = machine->COMGETTER(SettingsFilePath) (settingsFilePath.asOutParam()); 765 RTPrintf ("Config file: %lS\n", settingsFilePath.raw()); 766 ComPtr<IVirtualBoxErrorInfo> accessError; 767 rc = machine->COMGETTER(AccessError) (accessError.asOutParam()); 768 RTPrintf ("Access error details:\n"); 769 ErrorInfo ei (accessError); 770 ei.print ("[-] "); 771 RTPrintf ("\n"); 772 } 733 773 return S_OK; 734 774 } … … 736 776 Bstr machineName; 737 777 rc = machine->COMGETTER(Name)(machineName.asOutParam()); 738 RTPrintf("Name: %lS\n", machineName.raw()); 778 if (details == VMINFO_MACHINEREADABLE) 779 RTPrintf("name=\"%lS\"\n", machineName.raw()); 780 else 781 RTPrintf("Name: %lS\n", machineName.raw()); 739 782 740 783 Bstr osTypeId; … … 744 787 Bstr osName; 745 788 rc = osType->COMGETTER(Description)(osName.asOutParam()); 746 RTPrintf("Guest OS: %lS\n", osName.raw()); 789 if (details == VMINFO_MACHINEREADABLE) 790 RTPrintf("ostype=\"%lS\"\n", osTypeId.raw()); 791 else 792 RTPrintf("Guest OS: %lS\n", osName.raw()); 747 793 748 794 Guid uuid; 749 795 rc = machine->COMGETTER(Id)(uuid.asOutParam()); 750 RTPrintf("UUID: %s\n", uuid.toString().raw()); 796 if (details == VMINFO_MACHINEREADABLE) 797 RTPrintf("UUID=\"%s\"\n", uuid.toString().raw()); 798 else 799 RTPrintf("UUID: %s\n", uuid.toString().raw()); 751 800 752 801 Bstr settingsFilePath; 753 802 rc = machine->COMGETTER(SettingsFilePath)(settingsFilePath.asOutParam()); 754 RTPrintf("Config file: %lS\n", settingsFilePath.raw()); 803 if (details == VMINFO_MACHINEREADABLE) 804 RTPrintf("CfgFile=\"%lS\"\n", settingsFilePath.raw()); 805 else 806 RTPrintf("Config file: %lS\n", settingsFilePath.raw()); 755 807 756 808 ULONG memorySize; 757 809 rc = machine->COMGETTER(MemorySize)(&memorySize); 758 RTPrintf("Memory size: %uMB\n", memorySize); 810 if (details == VMINFO_MACHINEREADABLE) 811 RTPrintf("memory=%u\n", memorySize); 812 else 813 RTPrintf("Memory size: %uMB\n", memorySize); 759 814 760 815 ULONG vramSize; 761 816 rc = machine->COMGETTER(VRAMSize)(&vramSize); 762 RTPrintf("VRAM size: %uMB\n", vramSize); 817 if (details == VMINFO_MACHINEREADABLE) 818 RTPrintf("vram=%u\n", vramSize); 819 else 820 RTPrintf("VRAM size: %uMB\n", vramSize); 763 821 764 822 ComPtr <IBIOSSettings> biosSettings; … … 767 825 BIOSBootMenuMode_T bootMenuMode; 768 826 biosSettings->COMGETTER(BootMenuMode)(&bootMenuMode); 769 RTPrintf("Boot menu mode: ");827 const char *pszBootMenu = NULL; 770 828 switch (bootMenuMode) 771 829 { 772 830 case BIOSBootMenuMode_Disabled: 773 RTPrintf("disabled\n");831 pszBootMenu = "disabled"; 774 832 break; 775 833 case BIOSBootMenuMode_MenuOnly: 776 RTPrintf("menu only\n"); 834 if (details == VMINFO_MACHINEREADABLE) 835 pszBootMenu = "menuonly"; 836 else 837 pszBootMenu = "menu only"; 777 838 break; 778 839 default: 779 RTPrintf("message and menu\n"); 780 } 840 if (details == VMINFO_MACHINEREADABLE) 841 pszBootMenu = "messageandmenu"; 842 else 843 pszBootMenu = "message and menu"; 844 } 845 if (details == VMINFO_MACHINEREADABLE) 846 RTPrintf("bootmenu=\"%s\"\n", pszBootMenu); 847 else 848 RTPrintf("Boot menu mode: %s\n", pszBootMenu); 781 849 782 850 BOOL acpiEnabled; 783 851 biosSettings->COMGETTER(ACPIEnabled)(&acpiEnabled); 784 RTPrintf("ACPI: %s\n", acpiEnabled ? "on" : "off"); 852 if (details == VMINFO_MACHINEREADABLE) 853 RTPrintf("acpi=\"%s\"\n", acpiEnabled ? "on" : "off"); 854 else 855 RTPrintf("ACPI: %s\n", acpiEnabled ? "on" : "off"); 785 856 786 857 BOOL ioapicEnabled; 787 858 biosSettings->COMGETTER(IOAPICEnabled)(&ioapicEnabled); 788 RTPrintf("IOAPIC: %s\n", ioapicEnabled ? "on" : "off"); 859 if (details == VMINFO_MACHINEREADABLE) 860 RTPrintf("ioapic=\"%s\"\n", ioapicEnabled ? "on" : "off"); 861 else 862 RTPrintf("IOAPIC: %s\n", ioapicEnabled ? "on" : "off"); 789 863 790 864 LONG64 timeOffset; 791 865 biosSettings->COMGETTER(TimeOffset)(&timeOffset); 792 RTPrintf("Time offset: %lld ms\n", timeOffset); 866 if (details == VMINFO_MACHINEREADABLE) 867 RTPrintf("biossystemtimeoffset=%lld\n", timeOffset); 868 else 869 RTPrintf("Time offset: %lld ms\n", timeOffset); 793 870 794 871 TriStateBool_T hwVirtExEnabled; … … 800 877 virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 801 878 systemProperties->COMGETTER(HWVirtExEnabled)(&fHWVirtExEnabled); 802 RTPrintf("Hardw. virt.ext: Default (%s)\n", fHWVirtExEnabled ? "on" : "off"); 879 if (details == VMINFO_MACHINEREADABLE) 880 RTPrintf("hwvirtex=\"default\"\n"); 881 else 882 RTPrintf("Hardw. virt.ext: Default (%s)\n", fHWVirtExEnabled ? "on" : "off"); 803 883 } 804 884 else 805 885 { 806 RTPrintf("Hardw. virt.ext: %s\n", hwVirtExEnabled == TriStateBool_True ? "on" : "off"); 886 if (details == VMINFO_MACHINEREADABLE) 887 RTPrintf("hwvirtex=\"%s\"\n", hwVirtExEnabled == TriStateBool_True ? "on" : "off"); 888 else 889 RTPrintf("Hardw. virt.ext: %s\n", hwVirtExEnabled == TriStateBool_True ? "on" : "off"); 807 890 } 808 891 … … 813 896 { 814 897 case MachineState_PoweredOff: 815 pszState = "powered off"; 898 if (details == VMINFO_MACHINEREADABLE) 899 pszState = "poweroff"; 900 else 901 pszState = "powered off"; 816 902 break; 817 903 case MachineState_Saved: … … 849 935 char pszTime[30] = {0}; 850 936 RTTimeSpecToString(&timeSpec, pszTime, 30); 851 RTPrintf("State: %s (since %s)\n", pszState, pszTime); 937 if (details == VMINFO_MACHINEREADABLE) 938 { 939 RTPrintf("VMState=\"%s\"\n", pszState); 940 RTPrintf("VMStateChangeTime=\"%s\"\n", pszTime); 941 } 942 else 943 RTPrintf("State: %s (since %s)\n", pszState, pszTime); 852 944 853 945 ULONG numMonitors; 854 946 machine->COMGETTER(MonitorCount)(&numMonitors); 855 RTPrintf("Monitor count: %d\n", numMonitors); 947 if (details == VMINFO_MACHINEREADABLE) 948 RTPrintf("monitorcount=%d\n", numMonitors); 949 else 950 RTPrintf("Monitor count: %d\n", numMonitors); 856 951 857 952 ComPtr<IFloppyDrive> floppyDrive; … … 878 973 Guid imageGuid; 879 974 floppyImage->COMGETTER(Id)(imageGuid.asOutParam()); 880 pszFloppy = Utf8StrFmt("%lS (UUID: %s)", imagePath.raw(), imageGuid.toString().raw()); 975 if (details == VMINFO_MACHINEREADABLE) 976 { 977 RTPrintf("FloppyImageUUID=\"%s\"\n", imageGuid.toString().raw()); 978 pszFloppy = Utf8StrFmt("%lS", imagePath.raw()); 979 } 980 else 981 pszFloppy = Utf8StrFmt("%lS (UUID: %s)", imagePath.raw(), imageGuid.toString().raw()); 881 982 } 882 983 break; … … 891 992 Bstr driveName; 892 993 hostFloppyDrive->COMGETTER(Name)(driveName.asOutParam()); 893 pszFloppy = Utf8StrFmt("Host drive %lS", driveName.raw()); 994 if (details == VMINFO_MACHINEREADABLE) 995 pszFloppy = Utf8StrFmt("host:%lS", driveName.raw()); 996 else 997 pszFloppy = Utf8StrFmt("Host drive %lS", driveName.raw()); 894 998 } 895 999 break; … … 907 1011 pszFloppy = "disabled"; 908 1012 } 909 RTPrintf("Floppy: %s\n", pszFloppy.raw()); 1013 if (details == VMINFO_MACHINEREADABLE) 1014 RTPrintf("floppy=\"%s\"\n", pszFloppy.raw()); 1015 else 1016 RTPrintf("Floppy: %s\n", pszFloppy.raw()); 910 1017 } 911 1018 … … 922 1029 hardDisk->COMGETTER(Location)(filePath.asOutParam()); 923 1030 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 924 RTPrintf("Primary master: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw()); 1031 if (details == VMINFO_MACHINEREADABLE) 1032 { 1033 RTPrintf("hda=\"%lS\"\n", filePath.raw()); 1034 RTPrintf("HdaImageUUID=\"%s\"\n", uuid.toString().raw()); 1035 } 1036 else 1037 RTPrintf("Primary master: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw()); 1038 } 1039 else 1040 { 1041 if (details == VMINFO_MACHINEREADABLE) 1042 RTPrintf("hda=\"none\"\n"); 925 1043 } 926 1044 rc = machine->GetHardDisk(DiskControllerType_IDE0Controller, 1, hardDisk.asOutParam()); … … 934 1052 hardDisk->COMGETTER(Location)(filePath.asOutParam()); 935 1053 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 936 RTPrintf("Primary slave: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw()); 1054 if (details == VMINFO_MACHINEREADABLE) 1055 { 1056 RTPrintf("hdb=\"%lS\"\n", filePath.raw()); 1057 RTPrintf("HdbImageUUID=\"%s\"\n", uuid.toString().raw()); 1058 } 1059 else 1060 RTPrintf("Primary slave: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw()); 1061 } 1062 else 1063 { 1064 if (details == VMINFO_MACHINEREADABLE) 1065 RTPrintf("hdb=\"none\"\n"); 937 1066 } 938 1067 rc = machine->GetHardDisk(DiskControllerType_IDE1Controller, 1, hardDisk.asOutParam()); … … 946 1075 hardDisk->COMGETTER(Location)(filePath.asOutParam()); 947 1076 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 948 RTPrintf("Secondary slave: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw()); 1077 if (details == VMINFO_MACHINEREADABLE) 1078 { 1079 RTPrintf("hdd=\"%lS\"\n", filePath.raw()); 1080 RTPrintf("HddImageUUID=\"%s\"\n", uuid.toString().raw()); 1081 } 1082 else 1083 RTPrintf("Secondary slave: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw()); 1084 } 1085 else 1086 { 1087 if (details == VMINFO_MACHINEREADABLE) 1088 RTPrintf("hdd=\"none\"\n"); 949 1089 } 950 1090 ComPtr<IDVDDrive> dvdDrive; … … 960 1100 { 961 1101 rc = dvdImage->COMGETTER(Id)(uuid.asOutParam()); 962 RTPrintf("DVD: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw()); 1102 if (details == VMINFO_MACHINEREADABLE) 1103 { 1104 RTPrintf("dvd=\"%lS\"\n", filePath.raw()); 1105 RTPrintf("DvdImageUUID=\"%s\"\n", uuid.toString().raw()); 1106 } 1107 else 1108 RTPrintf("DVD: %lS (UUID: %s)\n", filePath.raw(), uuid.toString().raw()); 963 1109 } 964 1110 } … … 971 1117 Bstr name; 972 1118 hostDVDDrive->COMGETTER(Name)(name.asOutParam()); 973 RTPrintf("DVD: Host drive %lS", name.raw()); 1119 if (details == VMINFO_MACHINEREADABLE) 1120 RTPrintf("dvd=\"host:%lS\"\n", name.raw()); 1121 else 1122 RTPrintf("DVD: Host drive %lS", name.raw()); 974 1123 } 975 1124 else 976 RTPrintf("DVD: empty"); 1125 { 1126 if (details == VMINFO_MACHINEREADABLE) 1127 RTPrintf("dvd=\"none\"\n"); 1128 else 1129 RTPrintf("DVD: empty"); 1130 } 977 1131 BOOL fPassthrough; 978 1132 dvdDrive->COMGETTER(Passthrough)(&fPassthrough); 979 if (fPassthrough) 980 RTPrintf(" (passthrough enabled)"); 981 RTPrintf("\n"); 1133 if (details == VMINFO_MACHINEREADABLE) 1134 { 1135 RTPrintf("dvdpassthrough=\"%s\"\n", fPassthrough ? "on" : "off"); 1136 } 1137 else 1138 { 1139 if (fPassthrough) 1140 RTPrintf(" (passthrough enabled)"); 1141 RTPrintf("\n"); 1142 } 982 1143 } 983 1144 } … … 998 1159 if (!fEnabled) 999 1160 { 1000 RTPrintf("NIC %d: disabled\n", currentNIC + 1); 1161 if (details == VMINFO_MACHINEREADABLE) 1162 RTPrintf("nic%d=\"none\"\n", currentNIC + 1); 1163 else 1164 RTPrintf("NIC %d: disabled\n", currentNIC + 1); 1001 1165 } 1002 1166 else … … 1010 1174 { 1011 1175 case NetworkAttachmentType_NoNetworkAttachment: 1012 strAttachment = "none"; 1176 if (details == VMINFO_MACHINEREADABLE) 1177 strAttachment = "null"; 1178 else 1179 strAttachment = "none"; 1013 1180 break; 1014 1181 case NetworkAttachmentType_NATNetworkAttachment: 1015 strAttachment = "NAT"; 1182 if (details == VMINFO_MACHINEREADABLE) 1183 strAttachment = "nat"; 1184 else 1185 strAttachment = "NAT"; 1016 1186 break; 1017 1187 case NetworkAttachmentType_HostInterfaceNetworkAttachment: 1018 strAttachment = "Host Interface"; 1188 { 1189 Bstr strHostIfDev; 1190 nic->COMGETTER(HostInterface)(strHostIfDev.asOutParam()); 1191 if (details == VMINFO_MACHINEREADABLE) 1192 { 1193 RTPrintf("hostifdev%d=\"%lS\"\n", currentNIC + 1, strHostIfDev.raw()); 1194 strAttachment = "hostif"; 1195 } 1196 else 1197 strAttachment = Utf8StrFmt("Host Interface '%lS'", strHostIfDev.raw()); 1019 1198 break; 1199 } 1020 1200 case NetworkAttachmentType_InternalNetworkAttachment: 1021 1201 { 1022 1202 Bstr strNetwork; 1023 1203 nic->COMGETTER(InternalNetwork)(strNetwork.asOutParam()); 1024 strAttachment = Utf8StrFmt("Internal Network '%s'", Utf8Str(strNetwork).raw()); 1204 if (details == VMINFO_MACHINEREADABLE) 1205 { 1206 RTPrintf("intnet%d=\"%lS\"\n", currentNIC + 1, strNetwork.raw()); 1207 strAttachment = "intnet"; 1208 } 1209 else 1210 strAttachment = Utf8StrFmt("Internal Network '%s'", Utf8Str(strNetwork).raw()); 1025 1211 break; 1026 1212 } … … 1030 1216 } 1031 1217 1218 /* cable connected */ 1219 BOOL fConnected; 1220 nic->COMGETTER(CableConnected)(&fConnected); 1221 1032 1222 /* trace stuff */ 1033 1223 BOOL fTraceEnabled; … … 1036 1226 nic->COMGETTER(TraceFile)(traceFile.asOutParam()); 1037 1227 1038 RTPrintf("NIC %d: MAC: %lS, Attachment: %s, Trace: %s (file: %lS)\n", 1039 currentNIC + 1, strMACAddress.raw(), strAttachment.raw(), 1040 fTraceEnabled ? "on" : "off", traceFile.raw()); 1228 if (details == VMINFO_MACHINEREADABLE) 1229 { 1230 RTPrintf("macaddress%d=\"%lS\"\n", currentNIC + 1, strMACAddress.raw()); 1231 RTPrintf("cableconnected%d=\"%s\"\n", currentNIC + 1, fConnected ? "on" : "off"); 1232 RTPrintf("nic%d=\"%s\"\n", currentNIC + 1, strAttachment.raw()); 1233 } 1234 else 1235 RTPrintf("NIC %d: MAC: %lS, Attachment: %s, Cable connected: %s, Trace: %s (file: %lS)\n", 1236 currentNIC + 1, strMACAddress.raw(), strAttachment.raw(), 1237 fConnected ? "on" : "off", 1238 fTraceEnabled ? "on" : "off", traceFile.raw()); 1041 1239 } 1042 1240 } … … 1056 1254 if (!fEnabled) 1057 1255 { 1058 RTPrintf("UART %d: disabled\n", currentUART + 1); 1256 if (details == VMINFO_MACHINEREADABLE) 1257 RTPrintf("uart%d=\"off\"\n", currentUART + 1); 1258 else 1259 RTPrintf("UART %d: disabled\n", currentUART + 1); 1059 1260 } 1060 1261 else … … 1070 1271 uart->COMGETTER(HostMode)(&HostMode); 1071 1272 1072 RTPrintf("UART %d: I/O base: 0x%04x, IRQ: %d", 1073 currentUART + 1, ulIOBase, ulIRQ); 1273 if (details == VMINFO_MACHINEREADABLE) 1274 RTPrintf("uart%d=\"%#06x,%d\"\n", currentUART + 1, 1275 ulIOBase, ulIRQ); 1276 else 1277 RTPrintf("UART %d: I/O base: 0x%04x, IRQ: %d", 1278 currentUART + 1, ulIOBase, ulIRQ); 1074 1279 switch (HostMode) 1075 1280 { 1076 1281 default: 1077 1282 case PortMode_DisconnectedPort: 1078 RTPrintf(", disconnected\n"); 1283 if (details == VMINFO_MACHINEREADABLE) 1284 RTPrintf("uartmode%d=\"disconnected\"\n", currentUART + 1); 1285 else 1286 RTPrintf(", disconnected\n"); 1079 1287 break; 1080 1288 case PortMode_HostPipePort: 1081 RTPrintf(", attached to pipe (%s) '%lS'\n", 1082 fServer ? "server" : "client", path.raw()); 1289 if (details == VMINFO_MACHINEREADABLE) 1290 RTPrintf("uartmode%d=\"%s,%lS\"\n", currentUART + 1, 1291 fServer ? "server" : "client", path.raw()); 1292 else 1293 RTPrintf(", attached to pipe (%s) '%lS'\n", 1294 fServer ? "server" : "client", path.raw()); 1083 1295 break; 1084 1296 case PortMode_HostDevicePort: 1085 RTPrintf(", attached to device '%lS'\n", path.raw()); 1297 if (details == VMINFO_MACHINEREADABLE) 1298 RTPrintf("uartmode%d=\"%lS\"\n", currentUART + 1, 1299 path.raw()); 1300 else 1301 RTPrintf(", attached to device '%lS'\n", path.raw()); 1086 1302 break; 1087 1303 } … … 1103 1319 switch (enmType) 1104 1320 { 1105 case AudioDriverType_NullAudioDriver: psz = "Null"; break; 1106 case AudioDriverType_WINMMAudioDriver: psz = "WINMM"; break; 1107 case AudioDriverType_DSOUNDAudioDriver: psz = "DSOUND"; break; 1108 case AudioDriverType_OSSAudioDriver: psz = "OSS"; break; 1109 case AudioDriverType_ALSAAudioDriver: psz = "ALSA"; break; 1110 case AudioDriverType_CoreAudioDriver: psz = "CoreAudio"; break; 1111 default: ; break; 1321 case AudioDriverType_NullAudioDriver: 1322 if (details == VMINFO_MACHINEREADABLE) 1323 psz = "null"; 1324 else 1325 psz = "Null"; 1326 break; 1327 case AudioDriverType_WINMMAudioDriver: 1328 if (details == VMINFO_MACHINEREADABLE) 1329 psz = "winmm"; 1330 else 1331 psz = "WINMM"; 1332 break; 1333 case AudioDriverType_DSOUNDAudioDriver: 1334 if (details == VMINFO_MACHINEREADABLE) 1335 psz = "dsound"; 1336 else 1337 psz = "DSOUND"; 1338 break; 1339 case AudioDriverType_OSSAudioDriver: 1340 if (details == VMINFO_MACHINEREADABLE) 1341 psz = "oss"; 1342 else 1343 psz = "OSS"; 1344 break; 1345 case AudioDriverType_ALSAAudioDriver: 1346 if (details == VMINFO_MACHINEREADABLE) 1347 psz = "alsa"; 1348 else 1349 psz = "ALSA"; 1350 break; 1351 case AudioDriverType_CoreAudioDriver: 1352 if (details == VMINFO_MACHINEREADABLE) 1353 psz = "coreaudio"; 1354 else 1355 psz = "CoreAudio"; 1356 break; 1357 default: 1358 if (details == VMINFO_MACHINEREADABLE) 1359 psz = "unknown"; 1360 break; 1112 1361 } 1113 1362 } 1114 1363 else 1115 1364 fEnabled = FALSE; 1116 RTPrintf("Audio: %s (Driver: %s)\n", fEnabled ? "enabled" : "disabled", psz); 1365 if (details == VMINFO_MACHINEREADABLE) 1366 { 1367 if (fEnabled) 1368 RTPrintf("audio=\"%s\"\n", psz); 1369 else 1370 RTPrintf("audio=\"none\"\n"); 1371 } 1372 else 1373 RTPrintf("Audio: %s (Driver: %s)\n", fEnabled ? "enabled" : "disabled", psz); 1117 1374 } 1118 1375 … … 1120 1377 { 1121 1378 const char *psz = "Unknown"; 1122 ClipboardMode_T enmMode; 1123 rc = machine->COMGETTER(ClipboardMode)(&enmMode); 1124 switch (enmMode) 1125 { 1126 case ClipboardMode_ClipDisabled: psz = "disabled"; break; 1127 case ClipboardMode_ClipHostToGuest: psz = "HostToGuest"; break; 1128 case ClipboardMode_ClipGuestToHost: psz = "GuestToHost"; break; 1129 case ClipboardMode_ClipBidirectional: psz = "Bidirectional"; break; 1130 default: ; break; 1131 } 1132 RTPrintf("Clipboard Mode: %s\n", psz); 1379 ClipboardMode_T enmMode; 1380 rc = machine->COMGETTER(ClipboardMode)(&enmMode); 1381 switch (enmMode) 1382 { 1383 case ClipboardMode_ClipDisabled: 1384 if (details == VMINFO_MACHINEREADABLE) 1385 psz = "disabled"; 1386 else 1387 psz = "disabled"; 1388 break; 1389 case ClipboardMode_ClipHostToGuest: 1390 if (details == VMINFO_MACHINEREADABLE) 1391 psz = "hosttoguest"; 1392 else 1393 psz = "HostToGuest"; 1394 break; 1395 case ClipboardMode_ClipGuestToHost: 1396 if (details == VMINFO_MACHINEREADABLE) 1397 psz = "guesttohost"; 1398 else 1399 psz = "GuestToHost"; 1400 break; 1401 case ClipboardMode_ClipBidirectional: 1402 if (details == VMINFO_MACHINEREADABLE) 1403 psz = "bidirectional"; 1404 else 1405 psz = "Bidirectional"; 1406 break; 1407 default: 1408 if (details == VMINFO_MACHINEREADABLE) 1409 psz = "unknown"; 1410 break; 1411 } 1412 if (details == VMINFO_MACHINEREADABLE) 1413 RTPrintf("clipboard=\"%s\"\n", psz); 1414 else 1415 RTPrintf("Clipboard Mode: %s\n", psz); 1133 1416 } 1134 1417 … … 1141 1424 CHECK_ERROR_RET(display, COMGETTER(Height)(&yRes), rc); 1142 1425 CHECK_ERROR_RET(display, COMGETTER(BitsPerPixel)(&bpp), rc); 1143 RTPrintf("Video mode: %dx%dx%d\n", xRes, yRes, bpp); 1426 if (details == VMINFO_MACHINEREADABLE) 1427 RTPrintf("VideoMode=\"%d,%d,%d\"\n", xRes, yRes, bpp); 1428 else 1429 RTPrintf("Video mode: %dx%dx%d\n", xRes, yRes, bpp); 1144 1430 } 1145 1431 … … 1157 1443 ULONG port; 1158 1444 vrdpServer->COMGETTER(Port)(&port); 1445 Bstr address; 1446 vrdpServer->COMGETTER(NetAddress)(address.asOutParam()); 1447 BOOL fMultiCon; 1448 vrdpServer->COMGETTER(AllowMultiConnection)(&fMultiCon); 1159 1449 VRDPAuthType_T vrdpAuthType; 1160 1450 const char *strAuthType; … … 1175 1465 break; 1176 1466 } 1177 RTPrintf("VRDP: enabled (Port %d, Authentication type: %s)\n", port, strAuthType); 1467 if (details == VMINFO_MACHINEREADABLE) 1468 { 1469 RTPrintf("vrdp=\"on\"\n"); 1470 RTPrintf("vrdpport=%d\n", port); 1471 RTPrintf("vrdpaddress=\"%lS\"\n", address.raw()); 1472 RTPrintf("vrdpauthtype=\"%s\"\n", strAuthType); 1473 RTPrintf("vrdpmulticon=\"%s\"\n", fMultiCon ? "on" : "off"); 1474 } 1475 else 1476 RTPrintf("VRDP: enabled (Address %lS, Port %d, MultiConn: %s, Authentication type: %s)\n", address.raw(), port, fMultiCon ? "on" : "off", strAuthType); 1178 1477 } 1179 1478 else 1180 RTPrintf("VRDP: disabled\n"); 1479 { 1480 if (details == VMINFO_MACHINEREADABLE) 1481 RTPrintf("vrdp=\"off\"\n"); 1482 else 1483 RTPrintf("VRDP: disabled\n"); 1484 } 1181 1485 } 1182 1486 … … 1192 1496 if (FAILED(rc)) 1193 1497 fEnabled = false; 1194 RTPrintf("USB: %s\n", fEnabled ? "enabled" : "disabled"); 1195 1196 RTPrintf("\nUSB Device Filters:\n\n"); 1498 if (details == VMINFO_MACHINEREADABLE) 1499 RTPrintf("usb=\"%s\"\n", fEnabled ? "on" : "off"); 1500 else 1501 RTPrintf("USB: %s\n", fEnabled ? "enabled" : "disabled"); 1502 1503 if (details != VMINFO_MACHINEREADABLE) 1504 RTPrintf("\nUSB Device Filters:\n\n"); 1197 1505 1198 1506 ComPtr<IUSBDeviceFilterCollection> Coll; … … 1209 1517 if (!fMore) 1210 1518 { 1211 RTPrintf("<none>\n\n"); 1519 if (details != VMINFO_MACHINEREADABLE) 1520 RTPrintf("<none>\n\n"); 1212 1521 } 1213 1522 else … … 1220 1529 /* Query info. */ 1221 1530 1222 RTPrintf("Index: %lu\n", index); 1531 if (details == VMINFO_MACHINEREADABLE) 1532 RTPrintf("Index: %lu\n", index); 1223 1533 1224 1534 BOOL bActive = FALSE; 1225 1535 CHECK_ERROR_RET (DevPtr, COMGETTER (Active) (&bActive), rc); 1226 RTPrintf("Active: %s\n", bActive ? "yes" : "no"); 1536 if (details == VMINFO_MACHINEREADABLE) 1537 RTPrintf("USBFilterActive%d=\"%s\"\n", index + 1, bActive ? "on" : "off"); 1538 else 1539 RTPrintf("Active: %s\n", bActive ? "yes" : "no"); 1227 1540 1228 1541 Bstr bstr; 1229 1542 CHECK_ERROR_RET (DevPtr, COMGETTER (Name) (bstr.asOutParam()), rc); 1230 RTPrintf("Name: %lS\n", bstr.raw()); 1543 if (details == VMINFO_MACHINEREADABLE) 1544 RTPrintf("USBFilterName%d=\"%lS\"\n", index + 1, bstr.raw()); 1545 else 1546 RTPrintf("Name: %lS\n", bstr.raw()); 1231 1547 CHECK_ERROR_RET (DevPtr, COMGETTER (VendorId) (bstr.asOutParam()), rc); 1232 RTPrintf("VendorId: %lS\n", bstr.raw()); 1548 if (details == VMINFO_MACHINEREADABLE) 1549 RTPrintf("USBFilterVendorId%d=\"%lS\"\n", index + 1, bstr.raw()); 1550 else 1551 RTPrintf("VendorId: %lS\n", bstr.raw()); 1233 1552 CHECK_ERROR_RET (DevPtr, COMGETTER (ProductId) (bstr.asOutParam()), rc); 1234 RTPrintf("ProductId: %lS\n", bstr.raw()); 1553 if (details == VMINFO_MACHINEREADABLE) 1554 RTPrintf("USBFilterProductId%d=\"%lS\"\n", index + 1, bstr.raw()); 1555 else 1556 RTPrintf("ProductId: %lS\n", bstr.raw()); 1235 1557 CHECK_ERROR_RET (DevPtr, COMGETTER (Revision) (bstr.asOutParam()), rc); 1236 RTPrintf("Revision: %lS\n", bstr.raw()); 1558 if (details == VMINFO_MACHINEREADABLE) 1559 RTPrintf("USBFilterRevision%d=\"%lS\"\n", index + 1, bstr.raw()); 1560 else 1561 RTPrintf("Revision: %lS\n", bstr.raw()); 1237 1562 CHECK_ERROR_RET (DevPtr, COMGETTER (Manufacturer) (bstr.asOutParam()), rc); 1238 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1563 if (details == VMINFO_MACHINEREADABLE) 1564 RTPrintf("USBFilterManufacturer%d=\"%lS\"\n", index + 1, bstr.raw()); 1565 else 1566 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1239 1567 CHECK_ERROR_RET (DevPtr, COMGETTER (Product) (bstr.asOutParam()), rc); 1240 RTPrintf("Product: %lS\n", bstr.raw()); 1568 if (details == VMINFO_MACHINEREADABLE) 1569 RTPrintf("USBFilterProduct%d=\"%lS\"\n", index + 1, bstr.raw()); 1570 else 1571 RTPrintf("Product: %lS\n", bstr.raw()); 1572 CHECK_ERROR_RET (DevPtr, COMGETTER (Remote) (bstr.asOutParam()), rc); 1573 if (details == VMINFO_MACHINEREADABLE) 1574 RTPrintf("USBFilterRemote%d=\"%lS\"\n", index + 1, bstr.raw()); 1575 else 1576 RTPrintf("Remote: %lS\n\n", bstr.raw()); 1241 1577 CHECK_ERROR_RET (DevPtr, COMGETTER (SerialNumber) (bstr.asOutParam()), rc); 1242 RTPrintf("Serial Number: %lS\n\n", bstr.raw()); 1578 if (details == VMINFO_MACHINEREADABLE) 1579 RTPrintf("USBFilterSerialNumber%d=\"%lS\"\n", index + 1, bstr.raw()); 1580 else 1581 RTPrintf("Serial Number: %lS\n\n", bstr.raw()); 1243 1582 1244 1583 rc = Enum->HasMore (&fMore); … … 1250 1589 if (console) 1251 1590 { 1591 index = 0; 1252 1592 /* scope */ 1253 1593 { 1254 RTPrintf("Available remote USB devices:\n\n"); 1594 if (details != VMINFO_MACHINEREADABLE) 1595 RTPrintf("Available remote USB devices:\n\n"); 1255 1596 1256 1597 ComPtr<IHostUSBDeviceCollection> coll; … … 1266 1607 if (!more) 1267 1608 { 1268 RTPrintf("<none>\n\n"); 1609 if (details != VMINFO_MACHINEREADABLE) 1610 RTPrintf("<none>\n\n"); 1269 1611 } 1270 1612 else … … 1285 1627 CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), rc); 1286 1628 1287 RTPrintf("UUID: %S\n" 1288 "VendorId: 0x%04x (%04X)\n" 1289 "ProductId: 0x%04x (%04X)\n" 1290 "Revision: %u.%u (%02u%02u)\n", 1291 id.toString().raw(), 1292 usVendorId, usVendorId, usProductId, usProductId, 1293 bcdRevision >> 8, bcdRevision & 0xff, 1294 bcdRevision >> 8, bcdRevision & 0xff); 1629 if (details == VMINFO_MACHINEREADABLE) 1630 RTPrintf("USBRemoteUUID%d=\"%S\"\n" 1631 "USBRemoteVendorId%d=\"%#06x\"\n" 1632 "USBRemoteProductId%d=\"%#06x\"\n" 1633 "USBRemoteRevision%d=\"%#04x%02x\"\n", 1634 index + 1, id.toString().raw(), 1635 index + 1, usVendorId, 1636 index + 1, usProductId, 1637 index + 1, bcdRevision >> 8, bcdRevision & 0xff); 1638 else 1639 RTPrintf("UUID: %S\n" 1640 "VendorId: 0x%04x (%04X)\n" 1641 "ProductId: 0x%04x (%04X)\n" 1642 "Revision: %u.%u (%02u%02u)\n", 1643 id.toString().raw(), 1644 usVendorId, usVendorId, usProductId, usProductId, 1645 bcdRevision >> 8, bcdRevision & 0xff, 1646 bcdRevision >> 8, bcdRevision & 0xff); 1295 1647 1296 1648 /* optional stuff. */ … … 1298 1650 CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc); 1299 1651 if (!bstr.isEmpty()) 1300 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1652 { 1653 if (details == VMINFO_MACHINEREADABLE) 1654 RTPrintf("USBRemoteManufacturer%d=\"%lS\"\n", index + 1, bstr.raw()); 1655 else 1656 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1657 } 1301 1658 CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), rc); 1302 1659 if (!bstr.isEmpty()) 1303 RTPrintf("Product: %lS\n", bstr.raw()); 1660 { 1661 if (details == VMINFO_MACHINEREADABLE) 1662 RTPrintf("USBRemoteProduct%d=\"%lS\"\n", index + 1, bstr.raw()); 1663 else 1664 RTPrintf("Product: %lS\n", bstr.raw()); 1665 } 1304 1666 CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc); 1305 1667 if (!bstr.isEmpty()) 1306 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 1668 { 1669 if (details == VMINFO_MACHINEREADABLE) 1670 RTPrintf("USBRemoteSerialNumber%d=\"%lS\"\n", index + 1, bstr.raw()); 1671 else 1672 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 1673 } 1307 1674 CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), rc); 1308 1675 if (!bstr.isEmpty()) 1309 RTPrintf("Address: %lS\n", bstr.raw()); 1310 1311 RTPrintf("\n"); 1676 { 1677 if (details == VMINFO_MACHINEREADABLE) 1678 RTPrintf("USBRemoteAddress%d=\"%lS\"\n", index + 1, bstr.raw()); 1679 else 1680 RTPrintf("Address: %lS\n", bstr.raw()); 1681 } 1682 1683 if (details != VMINFO_MACHINEREADABLE) 1684 RTPrintf("\n"); 1312 1685 1313 1686 rc = en->HasMore (&more); 1314 1687 ASSERT_RET (SUCCEEDED (rc), rc); 1315 } 1316 } 1317 1688 1689 index ++; 1690 } 1691 } 1692 1693 index = 0; 1318 1694 /* scope */ 1319 1695 { 1320 RTPrintf ("Currently Attached USB Devices:\n\n"); 1696 if (details != VMINFO_MACHINEREADABLE) 1697 RTPrintf ("Currently Attached USB Devices:\n\n"); 1321 1698 1322 1699 ComPtr <IUSBDeviceCollection> coll; … … 1332 1709 if (!more) 1333 1710 { 1334 RTPrintf("<none>\n\n"); 1711 if (details != VMINFO_MACHINEREADABLE) 1712 RTPrintf("<none>\n\n"); 1335 1713 } 1336 1714 else … … 1351 1729 CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), rc); 1352 1730 1353 RTPrintf("UUID: %S\n" 1354 "VendorId: 0x%04x (%04X)\n" 1355 "ProductId: 0x%04x (%04X)\n" 1356 "Revision: %u.%u (%02u%02u)\n", 1357 id.toString().raw(), 1358 usVendorId, usVendorId, usProductId, usProductId, 1359 bcdRevision >> 8, bcdRevision & 0xff, 1360 bcdRevision >> 8, bcdRevision & 0xff); 1731 if (details == VMINFO_MACHINEREADABLE) 1732 RTPrintf("USBAttachedUUID%d=\"%S\"\n" 1733 "USBAttachedVendorId%d=\"%#06x\"\n" 1734 "USBAttachedProductId%d=\"%#06x\"\n" 1735 "USBAttachedRevision%d=\"%#04x%02x\"\n", 1736 index + 1, id.toString().raw(), 1737 index + 1, usVendorId, 1738 index + 1, usProductId, 1739 index + 1, bcdRevision >> 8, bcdRevision & 0xff); 1740 else 1741 RTPrintf("UUID: %S\n" 1742 "VendorId: 0x%04x (%04X)\n" 1743 "ProductId: 0x%04x (%04X)\n" 1744 "Revision: %u.%u (%02u%02u)\n", 1745 id.toString().raw(), 1746 usVendorId, usVendorId, usProductId, usProductId, 1747 bcdRevision >> 8, bcdRevision & 0xff, 1748 bcdRevision >> 8, bcdRevision & 0xff); 1361 1749 1362 1750 /* optional stuff. */ … … 1364 1752 CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc); 1365 1753 if (!bstr.isEmpty()) 1366 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1754 { 1755 if (details == VMINFO_MACHINEREADABLE) 1756 RTPrintf("USBAttachedManufacturer%d=\"%lS\"\n", index + 1, bstr.raw()); 1757 else 1758 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1759 } 1367 1760 CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), rc); 1368 1761 if (!bstr.isEmpty()) 1369 RTPrintf("Product: %lS\n", bstr.raw()); 1762 { 1763 if (details == VMINFO_MACHINEREADABLE) 1764 RTPrintf("USBAttachedProduct%d=\"%lS\"\n", index + 1, bstr.raw()); 1765 else 1766 RTPrintf("Product: %lS\n", bstr.raw()); 1767 } 1370 1768 CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc); 1371 1769 if (!bstr.isEmpty()) 1372 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 1770 { 1771 if (details == VMINFO_MACHINEREADABLE) 1772 RTPrintf("USBAttachedSerialNumber%d=\"%lS\"\n", index + 1, bstr.raw()); 1773 else 1774 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 1775 } 1373 1776 CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), rc); 1374 1777 if (!bstr.isEmpty()) 1375 RTPrintf("Address: %lS\n", bstr.raw()); 1376 1377 RTPrintf("\n"); 1778 { 1779 if (details == VMINFO_MACHINEREADABLE) 1780 RTPrintf("USBAttachedAddress%d=\"%lS\"\n", index + 1, bstr.raw()); 1781 else 1782 RTPrintf("Address: %lS\n", bstr.raw()); 1783 } 1784 1785 if (details != VMINFO_MACHINEREADABLE) 1786 RTPrintf("\n"); 1378 1787 1379 1788 rc = en->HasMore (&more); 1380 1789 ASSERT_RET (SUCCEEDED (rc), rc); 1790 1791 index ++; 1381 1792 } 1382 1793 } … … 1387 1798 * Shared folders 1388 1799 */ 1389 RTPrintf("Shared folders: "); 1800 if (details != VMINFO_MACHINEREADABLE) 1801 RTPrintf("Shared folders: "); 1390 1802 uint32_t numSharedFolders = 0; 1391 1803 #if 0 // not yet implemented … … 1417 1829 CHECK_ERROR_RET(machine, COMGETTER(SharedFolders)(sfColl.asOutParam()), rc); 1418 1830 CHECK_ERROR_RET(sfColl, Enumerate(sfEnum.asOutParam()), rc); 1831 ULONG index = 0; 1419 1832 BOOL fMore; 1420 1833 sfEnum->HasMore(&fMore); … … 1426 1839 sf->COMGETTER(Name)(name.asOutParam()); 1427 1840 sf->COMGETTER(HostPath)(hostPath.asOutParam()); 1428 if (!numSharedFolders )1841 if (!numSharedFolders && details != VMINFO_MACHINEREADABLE) 1429 1842 RTPrintf("\n\n"); 1430 RTPrintf("Name: '%lS', Host path: '%lS' (machine mapping)\n", name.raw(), hostPath.raw()); 1843 if (details == VMINFO_MACHINEREADABLE) 1844 { 1845 RTPrintf("SharedFolderNameMachineMapping%d=\"%lS\"\n", index + 1, 1846 name.raw()); 1847 RTPrintf("SharedFolderPathMachineMapping%d=\"%lS\"\n", index + 1, 1848 hostPath.raw()); 1849 } 1850 else 1851 RTPrintf("Name: '%lS', Host path: '%lS' (machine mapping)\n", name.raw(), hostPath.raw()); 1431 1852 ++numSharedFolders; 1432 1853 CHECK_ERROR_RET(sfEnum, HasMore(&fMore), rc); … … 1440 1861 CHECK_ERROR_RET(console, COMGETTER(SharedFolders)(sfColl.asOutParam()), rc); 1441 1862 CHECK_ERROR_RET(sfColl, Enumerate(sfEnum.asOutParam()), rc); 1863 ULONG index = 0; 1442 1864 BOOL fMore; 1443 1865 sfEnum->HasMore(&fMore); … … 1449 1871 sf->COMGETTER(Name)(name.asOutParam()); 1450 1872 sf->COMGETTER(HostPath)(hostPath.asOutParam()); 1451 if (!numSharedFolders )1873 if (!numSharedFolders && details != VMINFO_MACHINEREADABLE) 1452 1874 RTPrintf("\n\n"); 1453 RTPrintf("Name: '%lS', Host path: '%lS' (transient mapping)\n", name.raw(), hostPath.raw()); 1875 if (details == VMINFO_MACHINEREADABLE) 1876 { 1877 RTPrintf("SharedFolderNameTransientMapping%d=\"%lS\"\n", index + 1, 1878 name.raw()); 1879 RTPrintf("SharedFolderPathTransientMapping%d=\"%lS\"\n", index + 1, 1880 hostPath.raw()); 1881 } 1882 else 1883 RTPrintf("Name: '%lS', Host path: '%lS' (transient mapping)\n", name.raw(), hostPath.raw()); 1454 1884 ++numSharedFolders; 1455 1885 CHECK_ERROR_RET(sfEnum, HasMore(&fMore), rc); 1456 1886 } 1457 1887 } 1458 if (!numSharedFolders )1888 if (!numSharedFolders && details != VMINFO_MACHINEREADABLE) 1459 1889 RTPrintf("<none>\n"); 1460 RTPrintf("\n"); 1890 if (details != VMINFO_MACHINEREADABLE) 1891 RTPrintf("\n"); 1461 1892 1462 1893 if (console) … … 1497 1928 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(EncryptionStyle) (&EncryptionStyle), rc); 1498 1929 1499 RTPrintf("VRDP Connection: %s\n", Active? "active": "not active"); 1500 RTPrintf("Clients so far: %d\n", NumberOfClients); 1930 if (details == VMINFO_MACHINEREADABLE) 1931 RTPrintf("VRDPActiveConnection=\"%s\"\n", Active ? "on": "off"); 1932 else 1933 RTPrintf("VRDP Connection: %s\n", Active? "active": "not active"); 1934 1935 if (details == VMINFO_MACHINEREADABLE) 1936 RTPrintf("VRDPClients=%d\n", NumberOfClients); 1937 else 1938 RTPrintf("Clients so far: %d\n", NumberOfClients); 1501 1939 1502 1940 if (NumberOfClients > 0) … … 1507 1945 { 1508 1946 makeTimeStr (timestr, sizeof (timestr), BeginTime); 1509 RTPrintf("Start time: %s\n", timestr); 1947 if (details == VMINFO_MACHINEREADABLE) 1948 RTPrintf("VRDPStartTime=\"%s\"\n", timestr); 1949 else 1950 RTPrintf("Start time: %s\n", timestr); 1510 1951 } 1511 1952 else 1512 1953 { 1513 1954 makeTimeStr (timestr, sizeof (timestr), BeginTime); 1514 RTPrintf("Last started: %s\n", timestr); 1955 if (details == VMINFO_MACHINEREADABLE) 1956 RTPrintf("VRDPLastStartTime=\"%s\"\n", timestr); 1957 else 1958 RTPrintf("Last started: %s\n", timestr); 1515 1959 makeTimeStr (timestr, sizeof (timestr), EndTime); 1516 RTPrintf("Last ended: %s\n", timestr); 1517 } 1518 1519 RTPrintf("Sent: %llu Bytes\n", BytesSent); 1520 RTPrintf("Average speed: %llu B/s\n", (BytesSent * 1000) / (EndTime - BeginTime) ); 1521 RTPrintf("Sent total: %llu Bytes\n", BytesSentTotal); 1522 1523 RTPrintf("Received: %llu Bytes\n", BytesReceived); 1524 RTPrintf("Speed: %llu B/s\n", (BytesReceived * 1000) / (EndTime - BeginTime) ); 1525 RTPrintf("Received total: %llu Bytes\n", BytesReceivedTotal); 1960 if (details == VMINFO_MACHINEREADABLE) 1961 RTPrintf("VRDPLastEndTime=\"%s\"\n", timestr); 1962 else 1963 RTPrintf("Last ended: %s\n", timestr); 1964 } 1965 1966 if (details == VMINFO_MACHINEREADABLE) 1967 { 1968 RTPrintf("VRDPBytesSent=%llu\n", BytesSent); 1969 RTPrintf("VRDPThroughputSend=%llu\n", (BytesSent * 1000) / (EndTime - BeginTime) ); 1970 RTPrintf("VRDPBytesSentTotal=%llu\n", BytesSentTotal); 1971 1972 RTPrintf("VRDPBytesReceived=%llu\n", BytesReceived); 1973 RTPrintf("VRDPThroughputReceive=%llu\n", (BytesReceived * 1000) / (EndTime - BeginTime) ); 1974 RTPrintf("VRDPBytesReceivedTotal=%llu\n", BytesReceivedTotal); 1975 } 1976 else 1977 { 1978 RTPrintf("Sent: %llu Bytes\n", BytesSent); 1979 RTPrintf("Average speed: %llu B/s\n", (BytesSent * 1000) / (EndTime - BeginTime) ); 1980 RTPrintf("Sent total: %llu Bytes\n", BytesSentTotal); 1981 1982 RTPrintf("Received: %llu Bytes\n", BytesReceived); 1983 RTPrintf("Speed: %llu B/s\n", (BytesReceived * 1000) / (EndTime - BeginTime) ); 1984 RTPrintf("Received total: %llu Bytes\n", BytesReceivedTotal); 1985 } 1526 1986 1527 1987 if (Active) 1528 1988 { 1529 RTPrintf("User name: %lS\n", User.raw()); 1530 RTPrintf("Domain: %lS\n", Domain.raw()); 1531 RTPrintf("Client name: %lS\n", ClientName.raw()); 1532 RTPrintf("Client IP: %lS\n", ClientIP.raw()); 1533 RTPrintf("Client version: %d\n", ClientVersion); 1534 RTPrintf("Encryption: %s\n", EncryptionStyle == 0? "RDP4": "RDP5 (X.509)"); 1535 } 1536 } 1537 1538 RTPrintf("\n"); 1539 } 1540 1541 if (details == VMINFO_STANDARD || details == VMINFO_FULL) 1989 if (details == VMINFO_MACHINEREADABLE) 1990 { 1991 RTPrintf("VRDPUserName=\"%lS\"\n", User.raw()); 1992 RTPrintf("VRDPDomain=\"%lS\"\n", Domain.raw()); 1993 RTPrintf("VRDPClientName=\"%lS\"\n", ClientName.raw()); 1994 RTPrintf("VRDPClientIP=\"%lS\"\n", ClientIP.raw()); 1995 RTPrintf("VRDPClientVersion=%d\n", ClientVersion); 1996 RTPrintf("VRDPEncryption=\"%s\"\n", EncryptionStyle == 0? "RDP4": "RDP5 (X.509)"); 1997 } 1998 else 1999 { 2000 RTPrintf("User name: %lS\n", User.raw()); 2001 RTPrintf("Domain: %lS\n", Domain.raw()); 2002 RTPrintf("Client name: %lS\n", ClientName.raw()); 2003 RTPrintf("Client IP: %lS\n", ClientIP.raw()); 2004 RTPrintf("Client version: %d\n", ClientVersion); 2005 RTPrintf("Encryption: %s\n", EncryptionStyle == 0? "RDP4": "RDP5 (X.509)"); 2006 } 2007 } 2008 } 2009 2010 if (details != VMINFO_MACHINEREADABLE) 2011 RTPrintf("\n"); 2012 } 2013 2014 if ( details == VMINFO_STANDARD 2015 || details == VMINFO_FULL 2016 || details == VMINFO_MACHINEREADABLE) 1542 2017 { 1543 2018 Bstr description; … … 1545 2020 if (!description.isEmpty()) 1546 2021 { 1547 RTPrintf("Description:\n%lS\n", description.raw()); 2022 if (details == VMINFO_MACHINEREADABLE) 2023 RTPrintf("description=\"%lS\"\n", description.raw()); 2024 else 2025 RTPrintf("Description:\n%lS\n", description.raw()); 1548 2026 } 1549 2027 } 1550 2028 1551 2029 ULONG guestVal; 1552 RTPrintf("Guest:\n\n"); 2030 if (details != VMINFO_MACHINEREADABLE) 2031 RTPrintf("Guest:\n\n"); 1553 2032 1554 2033 rc = machine->COMGETTER(MemoryBalloonSize)(&guestVal); 1555 2034 if (SUCCEEDED(rc)) 1556 RTPrintf("Configured memory balloon size: %d MB\n", guestVal); 2035 { 2036 if (details == VMINFO_MACHINEREADABLE) 2037 RTPrintf("GuestMemoryBalloon=%d\n", guestVal); 2038 else 2039 RTPrintf("Configured memory balloon size: %d MB\n", guestVal); 2040 } 1557 2041 1558 2042 rc = machine->COMGETTER(StatisticsUpdateInterval)(&guestVal); 1559 2043 if (SUCCEEDED(rc)) 1560 2044 { 1561 if ( guestVal == 0)1562 RTPrintf(" Statistics update: disabled\n");2045 if (details == VMINFO_MACHINEREADABLE) 2046 RTPrintf("GuestStatisticsUpdateInterval=%d\n", guestVal); 1563 2047 else 1564 RTPrintf("Statistics update interval: %d seconds\n", guestVal); 1565 } 1566 RTPrintf("\n"); 2048 { 2049 if (guestVal == 0) 2050 RTPrintf("Statistics update: disabled\n"); 2051 else 2052 RTPrintf("Statistics update interval: %d seconds\n", guestVal); 2053 } 2054 } 2055 if (details != VMINFO_MACHINEREADABLE) 2056 RTPrintf("\n"); 1567 2057 1568 2058 if ( console 1569 && (details == VMINFO_STATISTICS || details == VMINFO_FULL)) 2059 && ( details == VMINFO_STATISTICS 2060 || details == VMINFO_FULL 2061 || details == VMINFO_MACHINEREADABLE)) 1570 2062 { 1571 2063 ComPtr <IGuest> guest; 1572 2064 1573 rc = console->COMGETTER(Guest)(guest.asOutParam()); 2065 rc = console->COMGETTER(Guest)(guest.asOutParam()); 1574 2066 if (SUCCEEDED(rc)) 1575 2067 { … … 1577 2069 1578 2070 rc = guest->GetStatistic(0, GuestStatisticType_SampleNumber, &statVal); 1579 RTPrintf("Guest statistics for sample %d:\n\n", statVal); 2071 if (details == VMINFO_MACHINEREADABLE) 2072 RTPrintf("StatGuestSample=%d\n", statVal); 2073 else 2074 RTPrintf("Guest statistics for sample %d:\n\n", statVal); 1580 2075 1581 2076 rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_Idle, &statVal); 1582 2077 if (SUCCEEDED(rc)) 1583 RTPrintf("CPU%d: CPU Load Idle %-3d%%\n", 0, statVal); 2078 { 2079 if (details == VMINFO_MACHINEREADABLE) 2080 RTPrintf("StatGuestLoadIdleCPU%d=%d\n", 0, statVal); 2081 else 2082 RTPrintf("CPU%d: CPU Load Idle %-3d%%\n", 0, statVal); 2083 } 1584 2084 1585 2085 rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_Kernel, &statVal); 1586 2086 if (SUCCEEDED(rc)) 1587 RTPrintf("CPU%d: CPU Load Kernel %-3d%%\n", 0, statVal); 2087 { 2088 if (details == VMINFO_MACHINEREADABLE) 2089 RTPrintf("StatGuestLoadKernelCPU%d=%d\n", 0, statVal); 2090 else 2091 RTPrintf("CPU%d: CPU Load Kernel %-3d%%\n", 0, statVal); 2092 } 1588 2093 1589 2094 rc = guest->GetStatistic(0, GuestStatisticType_CPULoad_User, &statVal); 1590 2095 if (SUCCEEDED(rc)) 1591 RTPrintf("CPU%d: CPU Load User %-3d%%\n", 0, statVal); 2096 { 2097 if (details == VMINFO_MACHINEREADABLE) 2098 RTPrintf("StatGuestLoadUserCPU%d=%d\n", 0, statVal); 2099 else 2100 RTPrintf("CPU%d: CPU Load User %-3d%%\n", 0, statVal); 2101 } 1592 2102 1593 2103 rc = guest->GetStatistic(0, GuestStatisticType_Threads, &statVal); 1594 2104 if (SUCCEEDED(rc)) 1595 RTPrintf("CPU%d: Threads %d\n", 0, statVal); 2105 { 2106 if (details == VMINFO_MACHINEREADABLE) 2107 RTPrintf("StatGuestThreadsCPU%d=%d\n", 0, statVal); 2108 else 2109 RTPrintf("CPU%d: Threads %d\n", 0, statVal); 2110 } 1596 2111 1597 2112 rc = guest->GetStatistic(0, GuestStatisticType_Processes, &statVal); 1598 2113 if (SUCCEEDED(rc)) 1599 RTPrintf("CPU%d: Processes %d\n", 0, statVal); 2114 { 2115 if (details == VMINFO_MACHINEREADABLE) 2116 RTPrintf("StatGuestProcessesCPU%d=%d\n", 0, statVal); 2117 else 2118 RTPrintf("CPU%d: Processes %d\n", 0, statVal); 2119 } 1600 2120 1601 2121 rc = guest->GetStatistic(0, GuestStatisticType_Handles, &statVal); 1602 2122 if (SUCCEEDED(rc)) 1603 RTPrintf("CPU%d: Handles %d\n", 0, statVal); 2123 { 2124 if (details == VMINFO_MACHINEREADABLE) 2125 RTPrintf("StatGuestHandlesCPU%d=%d\n", 0, statVal); 2126 else 2127 RTPrintf("CPU%d: Handles %d\n", 0, statVal); 2128 } 1604 2129 1605 2130 rc = guest->GetStatistic(0, GuestStatisticType_MemoryLoad, &statVal); 1606 2131 if (SUCCEEDED(rc)) 1607 RTPrintf("CPU%d: Memory Load %d%%\n", 0, statVal); 2132 { 2133 if (details == VMINFO_MACHINEREADABLE) 2134 RTPrintf("StatGuestMemoryLoadCPU%d=%d\n", 0, statVal); 2135 else 2136 RTPrintf("CPU%d: Memory Load %d%%\n", 0, statVal); 2137 } 1608 2138 1609 2139 rc = guest->GetStatistic(0, GuestStatisticType_PhysMemTotal, &statVal); 1610 2140 if (SUCCEEDED(rc)) 1611 RTPrintf("CPU%d: Total physical memory %-4d MB\n", 0, statVal); 2141 { 2142 if (details == VMINFO_MACHINEREADABLE) 2143 RTPrintf("StatGuestMemoryTotalPhysCPU%d=%d\n", 0, statVal); 2144 else 2145 RTPrintf("CPU%d: Total physical memory %-4d MB\n", 0, statVal); 2146 } 1612 2147 1613 2148 rc = guest->GetStatistic(0, GuestStatisticType_PhysMemAvailable, &statVal); 1614 2149 if (SUCCEEDED(rc)) 1615 RTPrintf("CPU%d: Free physical memory %-4d MB\n", 0, statVal); 2150 { 2151 if (details == VMINFO_MACHINEREADABLE) 2152 RTPrintf("StatGuestMemoryFreePhysCPU%d=%d\n", 0, statVal); 2153 else 2154 RTPrintf("CPU%d: Free physical memory %-4d MB\n", 0, statVal); 2155 } 1616 2156 1617 2157 rc = guest->GetStatistic(0, GuestStatisticType_PhysMemBalloon, &statVal); 1618 2158 if (SUCCEEDED(rc)) 1619 RTPrintf("CPU%d: Memory balloon size %-4d MB\n", 0, statVal); 2159 { 2160 if (details == VMINFO_MACHINEREADABLE) 2161 RTPrintf("StatGuestMemoryBalloonCPU%d=%d\n", 0, statVal); 2162 else 2163 RTPrintf("CPU%d: Memory balloon size %-4d MB\n", 0, statVal); 2164 } 1620 2165 1621 2166 rc = guest->GetStatistic(0, GuestStatisticType_MemCommitTotal, &statVal); 1622 2167 if (SUCCEEDED(rc)) 1623 RTPrintf("CPU%d: Committed memory %-4d MB\n", 0, statVal); 2168 { 2169 if (details == VMINFO_MACHINEREADABLE) 2170 RTPrintf("StatGuestMemoryCommittedCPU%d=%d\n", 0, statVal); 2171 else 2172 RTPrintf("CPU%d: Committed memory %-4d MB\n", 0, statVal); 2173 } 1624 2174 1625 2175 rc = guest->GetStatistic(0, GuestStatisticType_MemKernelTotal, &statVal); 1626 2176 if (SUCCEEDED(rc)) 1627 RTPrintf("CPU%d: Total kernel memory %-4d MB\n", 0, statVal); 2177 { 2178 if (details == VMINFO_MACHINEREADABLE) 2179 RTPrintf("StatGuestMemoryTotalKernelCPU%d=%d\n", 0, statVal); 2180 else 2181 RTPrintf("CPU%d: Total kernel memory %-4d MB\n", 0, statVal); 2182 } 1628 2183 1629 2184 rc = guest->GetStatistic(0, GuestStatisticType_MemKernelPaged, &statVal); 1630 2185 if (SUCCEEDED(rc)) 1631 RTPrintf("CPU%d: Paged kernel memory %-4d MB\n", 0, statVal); 2186 { 2187 if (details == VMINFO_MACHINEREADABLE) 2188 RTPrintf("StatGuestMemoryPagedKernelCPU%d=%d\n", 0, statVal); 2189 else 2190 RTPrintf("CPU%d: Paged kernel memory %-4d MB\n", 0, statVal); 2191 } 1632 2192 1633 2193 rc = guest->GetStatistic(0, GuestStatisticType_MemKernelNonpaged, &statVal); 1634 2194 if (SUCCEEDED(rc)) 1635 RTPrintf("CPU%d: Nonpaged kernel memory %-4d MB\n", 0, statVal); 2195 { 2196 if (details == VMINFO_MACHINEREADABLE) 2197 RTPrintf("StatGuestMemoryNonpagedKernelCPU%d=%d\n", 0, statVal); 2198 else 2199 RTPrintf("CPU%d: Nonpaged kernel memory %-4d MB\n", 0, statVal); 2200 } 1636 2201 1637 2202 rc = guest->GetStatistic(0, GuestStatisticType_MemSystemCache, &statVal); 1638 2203 if (SUCCEEDED(rc)) 1639 RTPrintf("CPU%d: System cache size %-4d MB\n", 0, statVal); 2204 { 2205 if (details == VMINFO_MACHINEREADABLE) 2206 RTPrintf("StatGuestSystemCacheSizeCPU%d=%d\n", 0, statVal); 2207 else 2208 RTPrintf("CPU%d: System cache size %-4d MB\n", 0, statVal); 2209 } 1640 2210 1641 2211 rc = guest->GetStatistic(0, GuestStatisticType_PageFileSize, &statVal); 1642 2212 if (SUCCEEDED(rc)) 1643 RTPrintf("CPU%d: Page file size %-4d MB\n", 0, statVal); 2213 { 2214 if (details == VMINFO_MACHINEREADABLE) 2215 RTPrintf("StatGuestPageFileSizeCPU%d=%d\n", 0, statVal); 2216 else 2217 RTPrintf("CPU%d: Page file size %-4d MB\n", 0, statVal); 2218 } 1644 2219 1645 2220 RTPrintf("\n"); … … 1647 2222 else 1648 2223 { 1649 RTPrintf("[!] FAILED calling console->getGuest at line %d!\n", __LINE__); 1650 PRINT_RC_MESSAGE(rc); 2224 if (details != VMINFO_MACHINEREADABLE) 2225 { 2226 RTPrintf("[!] FAILED calling console->getGuest at line %d!\n", __LINE__); 2227 PRINT_RC_MESSAGE(rc); 2228 } 1651 2229 } 1652 2230 } … … 1659 2237 if (SUCCEEDED(rc) && snapshot) 1660 2238 { 1661 RTPrintf("Snapshots:\n\n"); 1662 showSnapshots(snapshot); 1663 } 1664 1665 RTPrintf("\n"); 2239 if (details != VMINFO_MACHINEREADABLE) 2240 RTPrintf("Snapshots:\n\n"); 2241 showSnapshots(snapshot, details); 2242 } 2243 2244 if (details != VMINFO_MACHINEREADABLE) 2245 RTPrintf("\n"); 1666 2246 return S_OK; 1667 2247 } … … 1694 2274 return 1; 1695 2275 1696 /* 2nd option can be -details or -statistics*/2276 /* 2nd option can be -details, -statistics or -argdump */ 1697 2277 VMINFO_DETAILS details = VMINFO_NONE; 1698 2278 bool fDetails = false; 1699 2279 bool fStatistics = false; 2280 bool fMachinereadable = false; 1700 2281 for (int i=1;i<argc;i++) 1701 2282 { … … 1705 2286 if (!strcmp(argv[i], "-statistics")) 1706 2287 fStatistics = true; 1707 } 2288 if (!strcmp(argv[1], "-machinereadable")) 2289 fMachinereadable = true; 2290 } 2291 if (fMachinereadable) 2292 details = VMINFO_MACHINEREADABLE; 2293 else 1708 2294 if (fDetails && fStatistics) 1709 2295 details = VMINFO_FULL; … … 2843 3429 if (!!baseFolder && !!settingsFile) 2844 3430 { 2845 return errorSyntax(USAGE_CREATEVM, "Either -basefolder or -settingsfile m aybe specified");3431 return errorSyntax(USAGE_CREATEVM, "Either -basefolder or -settingsfile must be specified"); 2846 3432 } 2847 3433 … … 3837 4423 if (!hostDVDDrive) 3838 4424 { 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 4425 /* 2nd try: try with the real name, important on Linux+libhal */ 4426 char szPathReal[RTPATH_MAX]; 4427 if (VBOX_FAILURE(RTPathReal(dvd + 5, szPathReal, sizeof(szPathReal)))) 4428 { 4429 errorArgument("Invalid host DVD drive name"); 4430 rc = E_FAIL; 4431 break; 4432 } 4433 rc = hostDVDs->FindByName(Bstr(szPathReal), hostDVDDrive.asOutParam()); 4434 if (!hostDVDDrive) 4435 { 4436 errorArgument("Invalid host DVD drive name"); 4437 rc = E_FAIL; 4438 break; 4439 } 3854 4440 } 3855 4441 CHECK_ERROR(dvdDrive, CaptureHostDrive(hostDVDDrive)); … … 4846 5432 ComPtr <IGuest> guest; 4847 5433 4848 rc = console->COMGETTER(Guest)(guest.asOutParam()); 5434 rc = console->COMGETTER(Guest)(guest.asOutParam()); 4849 5435 if (SUCCEEDED(rc)) 4850 5436 CHECK_ERROR(guest, COMSETTER(MemoryBalloonSize)(uVal)); … … 4871 5457 ComPtr <IGuest> guest; 4872 5458 4873 rc = console->COMGETTER(Guest)(guest.asOutParam()); 5459 rc = console->COMGETTER(Guest)(guest.asOutParam()); 4874 5460 if (SUCCEEDED(rc)) 4875 5461 CHECK_ERROR(guest, COMSETTER(StatisticsUpdateInterval)(uVal)); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r4649 r4779 73 73 typedef enum 74 74 { 75 VMINFO_NONE = 0, 76 VMINFO_STANDARD = 1, /* standard details */ 77 VMINFO_STATISTICS = 2, /* guest statistics */ 78 VMINFO_FULL = 3, /* both */ 75 VMINFO_NONE = 0, 76 VMINFO_STANDARD = 1, /* standard details */ 77 VMINFO_STATISTICS = 2, /* guest statistics */ 78 VMINFO_FULL = 3, /* both */ 79 VMINFO_MACHINEREADABLE = 4, /* both, and make it machine readable */ 79 80 } VMINFO_DETAILS; 80 81
Note:
See TracChangeset
for help on using the changeset viewer.