1use vssetup::{HRESULT, SetupConfiguration, com};
8
9fn main() -> Result<(), HRESULT> {
10 com::initialize()?;
11
12 let list_packages = std::env::args().skip(1).any(|arg| arg == "--packages");
13 let display_help = std::env::args()
14 .skip(1)
15 .any(|arg| arg == "-h" || arg == "--help");
16 if display_help {
17 println!("usage: vsall [--packages]");
18 return Ok(());
19 }
20
21 let setup = SetupConfiguration::new()?;
22 let mut first = false;
23 for instance in setup.EnumInstances()? {
24 if first {
25 first = false;
26 } else {
27 println!();
28 }
29 println!(
30 "displayName: {}",
31 instance.GetDisplayName(0x400)?.to_string()
32 );
33 println!(
34 "description: {}",
35 instance.GetDescription(0x400)?.to_string()
36 );
37 println!("instanceId: {}", instance.GetInstanceId()?);
38 println!(
39 "installDate: FILETIME({})",
40 &instance.GetInstallDate()?.as_u64()
41 );
42 println!("installationPath: {}", instance.GetInstallationPath()?);
43 println!(
44 "installationVersion: {}",
45 instance.GetInstallationVersion()?
46 );
47 println!("state: {}", instance.GetState()?);
48 println!("enginePath: {}", instance.GetEnginePath()?);
49 println!("productPath: {}", instance.GetProductPath()?.to_string());
50 if let Ok(Some(product)) = instance.GetProduct() {
51 println!("product: {{");
52 println!(" id: {}", product.GetId()?);
53 println!(" uniqueId: {}", product.GetUniqueId()?);
54 println!(" version: {}", product.GetVersion()?);
55 println!(" type: {}", product.GetType()?);
56 println!(" branch: {}", product.GetBranch()?);
57 println!(" chip: {}", product.GetChip()?);
58 println!(" isExtension: {}", product.GetIsExtension()?);
59 println!(" isInstalled: {}", product.GetIsInstalled()?);
60 println!(" language: {}", product.GetLanguage()?);
61 println!(
62 " supportsExtensions: {}",
63 product.GetSupportsExtensions()?
64 );
65 println!("}}");
66 }
67 if let Ok(properties) = instance.to_property_store() {
68 println!("propertyStore: {{");
69 for property in properties.GetNames()?.iter() {
70 let value = properties.GetValue(property)?;
71 println!(" {property}: {value}");
72 }
73 println!("}}");
74 }
75 if let Ok(Some(properties)) = instance.GetProperties() {
76 println!("properties: {{");
77 for property in properties.GetNames()?.iter() {
78 let value = properties.GetValue(property)?;
79 println!(" {property}: {value}");
80 }
81 println!("}}");
82 }
83
84 if let Ok(catalog) = instance.to_catalog() {
85 println!("catalog: {{");
86 println!(" isPrerelease: {}", catalog.IsPrerelease()?);
87 if let Ok(Some(properties)) = catalog.GetCatalogInfo() {
88 for property in properties.GetNames()?.iter() {
89 let value = properties.GetValue(property)?;
90 println!(" {property}: {value}");
91 }
92 }
93 println!("}}");
94 }
95 if list_packages && let Ok(packages) = instance.GetPackages() {
96 println!("packages: [");
97 for package in packages.iter() {
98 println!(" {{");
99 println!(" id: {}", package.GetId()?);
100 println!(" uniqueId: {}", package.GetUniqueId()?);
101 println!(" version: {}", package.GetVersion()?);
102 println!(" type: {}", package.GetType()?);
103 println!(" branch: {}", package.GetBranch()?);
104 println!(" chip: {}", package.GetChip()?);
105 println!(" isExtension: {}", package.GetIsExtension()?);
106 println!(" language: {}", package.GetLanguage()?);
107 println!(" }}");
108 }
109 println!("]");
110 }
111 }
112 Ok(())
113}