Changeset 14611 in vbox
- Timestamp:
- Nov 26, 2008 12:37:11 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r14564 r14611 30 30 #include <VBox/com/array.h> 31 31 #include <VBox/com/ErrorInfo.h> 32 #include <VBox/com/EventQueue.h>33 32 34 33 #include <VBox/com/VirtualBox.h> 35 34 36 #include <stdlib.h>37 #include <stdarg.h>38 39 #include <vector>40 #include <list>41 42 #include <iprt/runtime.h>43 35 #include <iprt/stream.h> 44 36 #include <iprt/string.h> 45 #include <iprt/asm.h> 46 #include <iprt/uuid.h> 47 #include <iprt/thread.h> 48 #include <iprt/path.h> 49 #include <iprt/param.h> 50 #include <iprt/dir.h> 51 #include <iprt/file.h> 52 #include <iprt/env.h> 53 #include <iprt/cidr.h> 54 #include <VBox/err.h> 55 #include <VBox/version.h> 37 #include <VBox/log.h> 56 38 #include <VBox/VBoxHDD.h> 57 39 … … 62 44 // funcs 63 45 /////////////////////////////////////////////////////////////////////////////// 64 65 66 46 67 47 void showSnapshots(ComPtr<ISnapshot> rootSnapshot, VMINFO_DETAILS details, const Bstr &prefix /* = ""*/, int level /*= 0*/) … … 125 105 t.u8Hour, t.u8Minute, t.u8Second); 126 106 } 107 108 /* Disable global optimizations for MSC 8.0/64 to make it compile in reasonable 109 time. MSC 7.1/32 doesn't have any trouble with it. */ 110 #if defined(_MSC_VER) && defined(RT_ARCH_AMD64) 111 # pragma optimize("g", off) 112 #endif 127 113 128 114 HRESULT showVMInfo (ComPtr <IVirtualBox> virtualBox, ComPtr<IMachine> machine, … … 1936 1922 } 1937 1923 1938 int handleList(int argc, char *argv[], 1939 ComPtr<IVirtualBox> virtualBox, ComPtr<ISession> session) 1940 { 1941 HRESULT rc = S_OK; 1942 1943 /* exactly one option: the object */ 1944 if (argc != 1) 1945 return errorSyntax(USAGE_LIST, "Incorrect number of parameters"); 1946 1947 /* which object? */ 1948 if (strcmp(argv[0], "vms") == 0) 1949 { 1950 /* 1951 * Get the list of all registered VMs 1952 */ 1953 com::SafeIfaceArray <IMachine> machines; 1954 rc = virtualBox->COMGETTER(Machines2)(ComSafeArrayAsOutParam (machines)); 1955 if (SUCCEEDED(rc)) 1956 { 1957 /* 1958 * Iterate through the collection 1959 */ 1960 for (size_t i = 0; i < machines.size(); ++ i) 1961 { 1962 if (machines [i]) 1963 rc = showVMInfo(virtualBox, machines [i]); 1964 } 1965 } 1966 } 1967 else 1968 if (strcmp(argv[0], "runningvms") == 0) 1969 { 1970 /* 1971 * Get the list of all _running_ VMs 1972 */ 1973 com::SafeIfaceArray <IMachine> machines; 1974 rc = virtualBox->COMGETTER(Machines2)(ComSafeArrayAsOutParam (machines)); 1975 if (SUCCEEDED(rc)) 1976 { 1977 /* 1978 * Iterate through the collection 1979 */ 1980 for (size_t i = 0; i < machines.size(); ++ i) 1981 { 1982 if (machines [i]) 1983 { 1984 MachineState_T machineState; 1985 rc = machines [i]->COMGETTER(State)(&machineState); 1986 if (SUCCEEDED(rc)) 1987 { 1988 switch (machineState) 1989 { 1990 case MachineState_Running: 1991 case MachineState_Paused: 1992 { 1993 Guid uuid; 1994 rc = machines [i]->COMGETTER(Id) (uuid.asOutParam()); 1995 if (SUCCEEDED(rc)) 1996 RTPrintf ("%s\n", uuid.toString().raw()); 1997 break; 1998 } 1999 } 2000 } 2001 } 2002 } 2003 } 2004 } 2005 else 2006 if (strcmp(argv[0], "ostypes") == 0) 2007 { 2008 ComPtr<IGuestOSTypeCollection> coll; 2009 ComPtr<IGuestOSTypeEnumerator> enumerator; 2010 CHECK_ERROR(virtualBox, COMGETTER(GuestOSTypes)(coll.asOutParam())); 2011 if (SUCCEEDED(rc) && coll) 2012 { 2013 CHECK_ERROR(coll, Enumerate(enumerator.asOutParam())); 2014 BOOL hasMore; 2015 while (SUCCEEDED(enumerator->HasMore(&hasMore)) && hasMore) 2016 { 2017 ComPtr<IGuestOSType> guestOS; 2018 CHECK_RC_BREAK(enumerator->GetNext(guestOS.asOutParam())); 2019 Bstr guestId; 2020 guestOS->COMGETTER(Id)(guestId.asOutParam()); 2021 RTPrintf("ID: %lS\n", guestId.raw()); 2022 Bstr guestDescription; 2023 guestOS->COMGETTER(Description)(guestDescription.asOutParam()); 2024 RTPrintf("Description: %lS\n\n", guestDescription.raw()); 2025 } 2026 } 2027 } 2028 else 2029 if (strcmp(argv[0], "hostdvds") == 0) 2030 { 2031 ComPtr<IHost> host; 2032 CHECK_ERROR(virtualBox, COMGETTER(Host)(host.asOutParam())); 2033 ComPtr<IHostDVDDriveCollection> coll; 2034 ComPtr<IHostDVDDriveEnumerator> enumerator; 2035 CHECK_ERROR(host, COMGETTER(DVDDrives)(coll.asOutParam())); 2036 if (SUCCEEDED(rc) && coll) 2037 { 2038 CHECK_ERROR(coll, Enumerate(enumerator.asOutParam())); 2039 BOOL hasMore; 2040 while (SUCCEEDED(enumerator->HasMore(&hasMore)) && hasMore) 2041 { 2042 ComPtr<IHostDVDDrive> dvdDrive; 2043 CHECK_RC_BREAK(enumerator->GetNext(dvdDrive.asOutParam())); 2044 Bstr name; 2045 dvdDrive->COMGETTER(Name)(name.asOutParam()); 2046 RTPrintf("Name: %lS\n\n", name.raw()); 2047 } 2048 } 2049 } 2050 else 2051 if (strcmp(argv[0], "hostfloppies") == 0) 2052 { 2053 ComPtr<IHost> host; 2054 CHECK_ERROR(virtualBox, COMGETTER(Host)(host.asOutParam())); 2055 ComPtr<IHostFloppyDriveCollection> coll; 2056 ComPtr<IHostFloppyDriveEnumerator> enumerator; 2057 CHECK_ERROR(host, COMGETTER(FloppyDrives)(coll.asOutParam())); 2058 if (SUCCEEDED(rc) && coll) 2059 { 2060 CHECK_ERROR(coll, Enumerate(enumerator.asOutParam())); 2061 BOOL hasMore; 2062 while (SUCCEEDED(enumerator->HasMore(&hasMore)) && hasMore) 2063 { 2064 ComPtr<IHostFloppyDrive> floppyDrive; 2065 CHECK_RC_BREAK(enumerator->GetNext(floppyDrive.asOutParam())); 2066 Bstr name; 2067 floppyDrive->COMGETTER(Name)(name.asOutParam()); 2068 RTPrintf("Name: %lS\n\n", name.raw()); 2069 } 2070 } 2071 } 2072 else 2073 if (strcmp(argv[0], "hostifs") == 0) 2074 { 2075 ComPtr<IHost> host; 2076 CHECK_ERROR(virtualBox, COMGETTER(Host)(host.asOutParam())); 2077 ComPtr<IHostNetworkInterfaceCollection> coll; 2078 ComPtr<IHostNetworkInterfaceEnumerator> enumerator; 2079 CHECK_ERROR(host, COMGETTER(NetworkInterfaces)(coll.asOutParam())); 2080 if (SUCCEEDED(rc) && coll) 2081 { 2082 CHECK_ERROR(coll, Enumerate(enumerator.asOutParam())); 2083 BOOL hasMore; 2084 while (SUCCEEDED(enumerator->HasMore(&hasMore)) && hasMore) 2085 { 2086 ComPtr<IHostNetworkInterface> networkInterface; 2087 CHECK_RC_BREAK(enumerator->GetNext(networkInterface.asOutParam())); 2088 Bstr interfaceName; 2089 networkInterface->COMGETTER(Name)(interfaceName.asOutParam()); 2090 RTPrintf("Name: %lS\n", interfaceName.raw()); 2091 Guid interfaceGuid; 2092 networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam()); 2093 RTPrintf("GUID: %lS\n\n", Bstr(interfaceGuid.toString()).raw()); 2094 } 2095 } 2096 } 2097 else 2098 if (strcmp(argv[0], "hostinfo") == 0) 2099 { 2100 ComPtr<IHost> Host; 2101 CHECK_ERROR (virtualBox, COMGETTER(Host)(Host.asOutParam())); 2102 2103 RTPrintf("Host Information:\n\n"); 2104 2105 LONG64 uTCTime = 0; 2106 CHECK_ERROR (Host, COMGETTER(UTCTime)(&uTCTime)); 2107 RTTIMESPEC timeSpec; 2108 RTTimeSpecSetMilli(&timeSpec, uTCTime); 2109 char pszTime[30] = {0}; 2110 RTTimeSpecToString(&timeSpec, pszTime, sizeof(pszTime)); 2111 RTPrintf("Host time: %s\n", pszTime); 2112 2113 ULONG processorOnlineCount = 0; 2114 CHECK_ERROR (Host, COMGETTER(ProcessorOnlineCount)(&processorOnlineCount)); 2115 RTPrintf("Processor online count: %lu\n", processorOnlineCount); 2116 ULONG processorCount = 0; 2117 CHECK_ERROR (Host, COMGETTER(ProcessorCount)(&processorCount)); 2118 RTPrintf("Processor count: %lu\n", processorCount); 2119 ULONG processorSpeed = 0; 2120 Bstr processorDescription; 2121 for (ULONG i = 0; i < processorCount; i++) 2122 { 2123 CHECK_ERROR (Host, GetProcessorSpeed(i, &processorSpeed)); 2124 if (processorSpeed) 2125 RTPrintf("Processor#%u speed: %lu MHz\n", i, processorSpeed); 2126 else 2127 RTPrintf("Processor#%u speed: unknown\n", i, processorSpeed); 2128 #if 0 /* not yet implemented in Main */ 2129 CHECK_ERROR (Host, GetProcessorDescription(i, processorDescription.asOutParam())); 2130 RTPrintf("Processor#%u description: %lS\n", i, processorDescription.raw()); 2131 #endif 2132 } 2133 2134 #if 0 /* not yet implemented in Main */ 2135 ULONG memorySize = 0; 2136 CHECK_ERROR (Host, COMGETTER(MemorySize)(&memorySize)); 2137 RTPrintf("Memory size: %lu MByte\n", memorySize); 2138 2139 ULONG memoryAvailable = 0; 2140 CHECK_ERROR (Host, COMGETTER(MemoryAvailable)(&memoryAvailable)); 2141 RTPrintf("Memory available: %lu MByte\n", memoryAvailable); 2142 2143 Bstr operatingSystem; 2144 CHECK_ERROR (Host, COMGETTER(OperatingSystem)(operatingSystem.asOutParam())); 2145 RTPrintf("Operating system: %lS\n", operatingSystem.raw()); 2146 2147 Bstr oSVersion; 2148 CHECK_ERROR (Host, COMGETTER(OSVersion)(oSVersion.asOutParam())); 2149 RTPrintf("Operating system version: %lS\n", oSVersion.raw()); 2150 #endif 2151 } 2152 else 2153 if (strcmp(argv[0], "hddbackends") == 0) 2154 { 2155 ComPtr<ISystemProperties> systemProperties; 2156 CHECK_ERROR(virtualBox, 2157 COMGETTER(SystemProperties) (systemProperties.asOutParam())); 2158 com::SafeIfaceArray <IHardDiskFormat> hardDiskFormats; 2159 CHECK_ERROR(systemProperties, 2160 COMGETTER(HardDiskFormats) (ComSafeArrayAsOutParam (hardDiskFormats))); 2161 2162 RTPrintf("Supported hard disk backends:\n\n"); 2163 for (size_t i = 0; i < hardDiskFormats.size(); ++ i) 2164 { 2165 /* General information */ 2166 Bstr id; 2167 CHECK_ERROR(hardDiskFormats [i], 2168 COMGETTER(Id) (id.asOutParam())); 2169 2170 Bstr description; 2171 CHECK_ERROR(hardDiskFormats [i], 2172 COMGETTER(Id) (description.asOutParam())); 2173 2174 ULONG caps; 2175 CHECK_ERROR(hardDiskFormats [i], 2176 COMGETTER(Capabilities) (&caps)); 2177 2178 RTPrintf("Backend %u: id='%ls' description='%ls' capabilities=%#06x extensions='", 2179 i, id.raw(), description.raw(), caps); 2180 2181 /* File extensions */ 2182 com::SafeArray <BSTR> fileExtensions; 2183 CHECK_ERROR(hardDiskFormats [i], 2184 COMGETTER(FileExtensions) (ComSafeArrayAsOutParam (fileExtensions))); 2185 for (size_t a = 0; a < fileExtensions.size(); ++ a) 2186 { 2187 RTPrintf ("%ls", Bstr (fileExtensions [a]).raw()); 2188 if (a != fileExtensions.size()-1) 2189 RTPrintf (","); 2190 } 2191 RTPrintf ("'"); 2192 2193 /* Configuration keys */ 2194 com::SafeArray <BSTR> propertyNames; 2195 com::SafeArray <BSTR> propertyDescriptions; 2196 com::SafeArray <DataType_T> propertyTypes; 2197 com::SafeArray <ULONG> propertyFlags; 2198 com::SafeArray <BSTR> propertyDefaults; 2199 CHECK_ERROR(hardDiskFormats [i], 2200 DescribeProperties (ComSafeArrayAsOutParam (propertyNames), 2201 ComSafeArrayAsOutParam (propertyDescriptions), 2202 ComSafeArrayAsOutParam (propertyTypes), 2203 ComSafeArrayAsOutParam (propertyFlags), 2204 ComSafeArrayAsOutParam (propertyDefaults))); 2205 2206 RTPrintf (" properties=("); 2207 if (propertyNames.size() > 0) 2208 { 2209 for (size_t a = 0; a < propertyNames.size(); ++ a) 2210 { 2211 RTPrintf ("\n name='%ls' desc='%ls' type=", 2212 Bstr (propertyNames [a]).raw(), Bstr (propertyDescriptions [a]).raw()); 2213 switch (propertyTypes [a]) 2214 { 2215 case DataType_Int32: RTPrintf ("int"); break; 2216 case DataType_Int8: RTPrintf ("byte"); break; 2217 case DataType_String: RTPrintf ("string"); break; 2218 } 2219 RTPrintf (" flags=%#04x", propertyFlags [a]); 2220 RTPrintf (" default='%ls'", Bstr (propertyDefaults [a]).raw()); 2221 if (a != propertyNames.size()-1) 2222 RTPrintf (", "); 2223 } 2224 } 2225 RTPrintf (")\n"); 2226 } 2227 } 2228 else 2229 if (strcmp(argv[0], "hdds") == 0) 2230 { 2231 com::SafeIfaceArray <IHardDisk2> hdds; 2232 CHECK_ERROR(virtualBox, COMGETTER(HardDisks2)(ComSafeArrayAsOutParam (hdds))); 2233 for (size_t i = 0; i < hdds.size(); ++ i) 2234 { 2235 ComPtr<IHardDisk2> hdd = hdds[i]; 2236 Guid uuid; 2237 hdd->COMGETTER(Id)(uuid.asOutParam()); 2238 RTPrintf("UUID: %s\n", uuid.toString().raw()); 2239 Bstr format; 2240 hdd->COMGETTER(Format)(format.asOutParam()); 2241 RTPrintf("Format: %lS\n", format.raw()); 2242 Bstr filepath; 2243 hdd->COMGETTER(Location)(filepath.asOutParam()); 2244 RTPrintf("Location: %lS\n", filepath.raw()); 2245 MediaState_T enmState; 2246 /// @todo NEWMEDIA check accessibility of all parents 2247 /// @todo NEWMEDIA print the full state value 2248 hdd->COMGETTER(State)(&enmState); 2249 RTPrintf("Accessible: %s\n", enmState != MediaState_Inaccessible ? "yes" : "no"); 2250 com::SafeGUIDArray machineIds; 2251 hdd->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds)); 2252 for (size_t j = 0; j < machineIds.size(); ++ j) 2253 { 2254 ComPtr<IMachine> machine; 2255 CHECK_ERROR(virtualBox, GetMachine(machineIds[j], machine.asOutParam())); 2256 ASSERT(machine); 2257 Bstr name; 2258 machine->COMGETTER(Name)(name.asOutParam()); 2259 machine->COMGETTER(Id)(uuid.asOutParam()); 2260 RTPrintf("%s%lS (UUID: %RTuuid)\n", 2261 j == 0 ? "Usage: " : " ", 2262 name.raw(), &machineIds[j]); 2263 } 2264 /// @todo NEWMEDIA check usage in snapshots too 2265 /// @todo NEWMEDIA also list children and say 'differencing' for 2266 /// hard disks with the parent or 'base' otherwise. 2267 RTPrintf("\n"); 2268 } 2269 } 2270 else 2271 if (strcmp(argv[0], "dvds") == 0) 2272 { 2273 com::SafeIfaceArray<IDVDImage2> dvds; 2274 CHECK_ERROR(virtualBox, COMGETTER(DVDImages)(ComSafeArrayAsOutParam(dvds))); 2275 for (size_t i = 0; i < dvds.size(); ++ i) 2276 { 2277 ComPtr<IDVDImage2> dvdImage = dvds[i]; 2278 Guid uuid; 2279 dvdImage->COMGETTER(Id)(uuid.asOutParam()); 2280 RTPrintf("UUID: %s\n", uuid.toString().raw()); 2281 Bstr filePath; 2282 dvdImage->COMGETTER(Location)(filePath.asOutParam()); 2283 RTPrintf("Path: %lS\n", filePath.raw()); 2284 MediaState_T enmState; 2285 dvdImage->COMGETTER(State)(&enmState); 2286 RTPrintf("Accessible: %s\n", enmState != MediaState_Inaccessible ? "yes" : "no"); 2287 /** @todo usage */ 2288 RTPrintf("\n"); 2289 } 2290 } 2291 else 2292 if (strcmp(argv[0], "floppies") == 0) 2293 { 2294 com::SafeIfaceArray<IFloppyImage2> floppies; 2295 CHECK_ERROR(virtualBox, COMGETTER(FloppyImages)(ComSafeArrayAsOutParam(floppies))); 2296 for (size_t i = 0; i < floppies.size(); ++ i) 2297 { 2298 ComPtr<IFloppyImage2> floppyImage = floppies[i]; 2299 Guid uuid; 2300 floppyImage->COMGETTER(Id)(uuid.asOutParam()); 2301 RTPrintf("UUID: %s\n", uuid.toString().raw()); 2302 Bstr filePath; 2303 floppyImage->COMGETTER(Location)(filePath.asOutParam()); 2304 RTPrintf("Path: %lS\n", filePath.raw()); 2305 MediaState_T enmState; 2306 floppyImage->COMGETTER(State)(&enmState); 2307 RTPrintf("Accessible: %s\n", enmState != MediaState_Inaccessible ? "yes" : "no"); 2308 /** @todo usage */ 2309 RTPrintf("\n"); 2310 } 2311 } 2312 else 2313 if (strcmp(argv[0], "usbhost") == 0) 2314 { 2315 ComPtr<IHost> Host; 2316 CHECK_ERROR_RET (virtualBox, COMGETTER(Host)(Host.asOutParam()), 1); 2317 2318 ComPtr<IHostUSBDeviceCollection> CollPtr; 2319 CHECK_ERROR_RET (Host, COMGETTER(USBDevices)(CollPtr.asOutParam()), 1); 2320 2321 ComPtr<IHostUSBDeviceEnumerator> EnumPtr; 2322 CHECK_ERROR_RET (CollPtr, Enumerate(EnumPtr.asOutParam()), 1); 2323 2324 RTPrintf("Host USB Devices:\n\n"); 2325 2326 BOOL fMore = FALSE; 2327 rc = EnumPtr->HasMore (&fMore); 2328 ASSERT_RET (SUCCEEDED (rc), 1); 2329 2330 if (!fMore) 2331 { 2332 RTPrintf("<none>\n\n"); 2333 } 2334 else 2335 while (fMore) 2336 { 2337 ComPtr <IHostUSBDevice> dev; 2338 rc = EnumPtr->GetNext (dev.asOutParam()); 2339 ASSERT_RET (SUCCEEDED (rc), 1); 2340 2341 /* Query info. */ 2342 Guid id; 2343 CHECK_ERROR_RET (dev, COMGETTER(Id)(id.asOutParam()), 1); 2344 USHORT usVendorId; 2345 CHECK_ERROR_RET (dev, COMGETTER(VendorId)(&usVendorId), 1); 2346 USHORT usProductId; 2347 CHECK_ERROR_RET (dev, COMGETTER(ProductId)(&usProductId), 1); 2348 USHORT bcdRevision; 2349 CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), 1); 2350 2351 RTPrintf("UUID: %S\n" 2352 "VendorId: 0x%04x (%04X)\n" 2353 "ProductId: 0x%04x (%04X)\n" 2354 "Revision: %u.%u (%02u%02u)\n", 2355 id.toString().raw(), 2356 usVendorId, usVendorId, usProductId, usProductId, 2357 bcdRevision >> 8, bcdRevision & 0xff, 2358 bcdRevision >> 8, bcdRevision & 0xff); 2359 2360 /* optional stuff. */ 2361 Bstr bstr; 2362 CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), 1); 2363 if (!bstr.isEmpty()) 2364 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 2365 CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), 1); 2366 if (!bstr.isEmpty()) 2367 RTPrintf("Product: %lS\n", bstr.raw()); 2368 CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), 1); 2369 if (!bstr.isEmpty()) 2370 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 2371 CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), 1); 2372 if (!bstr.isEmpty()) 2373 RTPrintf("Address: %lS\n", bstr.raw()); 2374 2375 /* current state */ 2376 USBDeviceState_T state; 2377 CHECK_ERROR_RET (dev, COMGETTER(State)(&state), 1); 2378 const char *pszState = "?"; 2379 switch (state) 2380 { 2381 case USBDeviceState_NotSupported: 2382 pszState = "Not supported"; break; 2383 case USBDeviceState_Unavailable: 2384 pszState = "Unavailable"; break; 2385 case USBDeviceState_Busy: 2386 pszState = "Busy"; break; 2387 case USBDeviceState_Available: 2388 pszState = "Available"; break; 2389 case USBDeviceState_Held: 2390 pszState = "Held"; break; 2391 case USBDeviceState_Captured: 2392 pszState = "Captured"; break; 2393 default: 2394 ASSERT (false); 2395 break; 2396 } 2397 RTPrintf("Current State: %s\n\n", pszState); 2398 2399 rc = EnumPtr->HasMore (&fMore); 2400 ASSERT_RET (SUCCEEDED (rc), rc); 2401 } 2402 } 2403 else 2404 if (strcmp(argv[0], "usbfilters") == 0) 2405 { 2406 RTPrintf("Global USB Device Filters:\n\n"); 2407 2408 ComPtr <IHost> host; 2409 CHECK_ERROR_RET (virtualBox, COMGETTER(Host) (host.asOutParam()), 1); 2410 2411 ComPtr<IHostUSBDeviceFilterCollection> coll; 2412 CHECK_ERROR_RET (host, COMGETTER (USBDeviceFilters)(coll.asOutParam()), 1); 2413 2414 ComPtr<IHostUSBDeviceFilterEnumerator> en; 2415 CHECK_ERROR_RET (coll, Enumerate(en.asOutParam()), 1); 2416 2417 ULONG index = 0; 2418 BOOL more = FALSE; 2419 rc = en->HasMore (&more); 2420 ASSERT_RET (SUCCEEDED (rc), 1); 2421 2422 if (!more) 2423 { 2424 RTPrintf("<none>\n\n"); 2425 } 2426 else 2427 while (more) 2428 { 2429 ComPtr<IHostUSBDeviceFilter> flt; 2430 rc = en->GetNext (flt.asOutParam()); 2431 ASSERT_RET (SUCCEEDED (rc), 1); 2432 2433 /* Query info. */ 2434 2435 RTPrintf("Index: %lu\n", index); 2436 2437 BOOL active = FALSE; 2438 CHECK_ERROR_RET (flt, COMGETTER (Active) (&active), 1); 2439 RTPrintf("Active: %s\n", active ? "yes" : "no"); 2440 2441 USBDeviceFilterAction_T action; 2442 CHECK_ERROR_RET (flt, COMGETTER (Action) (&action), 1); 2443 const char *pszAction = "<invalid>"; 2444 switch (action) 2445 { 2446 case USBDeviceFilterAction_Ignore: 2447 pszAction = "Ignore"; 2448 break; 2449 case USBDeviceFilterAction_Hold: 2450 pszAction = "Hold"; 2451 break; 2452 default: 2453 break; 2454 } 2455 RTPrintf("Action: %s\n", pszAction); 2456 2457 Bstr bstr; 2458 CHECK_ERROR_RET (flt, COMGETTER (Name) (bstr.asOutParam()), 1); 2459 RTPrintf("Name: %lS\n", bstr.raw()); 2460 CHECK_ERROR_RET (flt, COMGETTER (VendorId) (bstr.asOutParam()), 1); 2461 RTPrintf("VendorId: %lS\n", bstr.raw()); 2462 CHECK_ERROR_RET (flt, COMGETTER (ProductId) (bstr.asOutParam()), 1); 2463 RTPrintf("ProductId: %lS\n", bstr.raw()); 2464 CHECK_ERROR_RET (flt, COMGETTER (Revision) (bstr.asOutParam()), 1); 2465 RTPrintf("Revision: %lS\n", bstr.raw()); 2466 CHECK_ERROR_RET (flt, COMGETTER (Manufacturer) (bstr.asOutParam()), 1); 2467 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 2468 CHECK_ERROR_RET (flt, COMGETTER (Product) (bstr.asOutParam()), 1); 2469 RTPrintf("Product: %lS\n", bstr.raw()); 2470 CHECK_ERROR_RET (flt, COMGETTER (SerialNumber) (bstr.asOutParam()), 1); 2471 RTPrintf("Serial Number: %lS\n\n", bstr.raw()); 2472 2473 rc = en->HasMore (&more); 2474 ASSERT_RET (SUCCEEDED (rc), 1); 2475 2476 index ++; 2477 } 2478 } 2479 else if (strcmp(argv[0], "systemproperties") == 0) 2480 { 2481 ComPtr<ISystemProperties> systemProperties; 2482 virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 2483 2484 Bstr str; 2485 ULONG ulValue; 2486 ULONG64 ul64Value; 2487 BOOL flag; 2488 2489 systemProperties->COMGETTER(MinGuestRAM)(&ulValue); 2490 RTPrintf("Minimum guest RAM size: %u Megabytes\n", ulValue); 2491 systemProperties->COMGETTER(MaxGuestRAM)(&ulValue); 2492 RTPrintf("Maximum guest RAM size: %u Megabytes\n", ulValue); 2493 systemProperties->COMGETTER(MaxGuestVRAM)(&ulValue); 2494 RTPrintf("Maximum video RAM size: %u Megabytes\n", ulValue); 2495 systemProperties->COMGETTER(MaxVDISize)(&ul64Value); 2496 RTPrintf("Maximum VDI size: %lu Megabytes\n", ul64Value); 2497 systemProperties->COMGETTER(DefaultHardDiskFolder)(str.asOutParam()); 2498 RTPrintf("Default hard disk filder: %lS\n", str.raw()); 2499 systemProperties->COMGETTER(DefaultMachineFolder)(str.asOutParam()); 2500 RTPrintf("Default machine folder: %lS\n", str.raw()); 2501 systemProperties->COMGETTER(RemoteDisplayAuthLibrary)(str.asOutParam()); 2502 RTPrintf("VRDP authentication library: %lS\n", str.raw()); 2503 systemProperties->COMGETTER(WebServiceAuthLibrary)(str.asOutParam()); 2504 RTPrintf("Webservice auth. library: %lS\n", str.raw()); 2505 systemProperties->COMGETTER(HWVirtExEnabled)(&flag); 2506 RTPrintf("Hardware virt. extensions: %s\n", flag ? "yes" : "no"); 2507 systemProperties->COMGETTER(LogHistoryCount)(&ulValue); 2508 RTPrintf("Log history count: %u\n", ulValue); 2509 2510 } 2511 else 2512 return errorSyntax(USAGE_LIST, "Invalid parameter '%s'", Utf8Str(argv[0]).raw()); 2513 2514 return SUCCEEDED(rc) ? 0 : 1; 2515 } 2516 2517 #endif /* VBOX_ONLY_DOCS */ 2518 1924 #endif /* !VBOX_ONLY_DOCS */ 1925
Note:
See TracChangeset
for help on using the changeset viewer.