windows_snapshot/operating_system/multimedia_audio_visual.rs
1//! The class in the Multimedia Audio or Visual subcategory represents properties of the audio or video codec installed on the computer system.
2//!
3//! | Class | Description |
4//! |---------------------------------------------|------------------------------------------------------------------------------------------------------------|
5//! | [**Win32\_CodecFile**](win32-codecfile.md) | Instance class<br/> Represents the audio or video codec installed on the computer system.<br/> |
6
7use crate::{update};
8use serde::{Deserialize, Serialize};
9use std::time::SystemTime;
10use wmi::{COMLibrary, WMIConnection, WMIDateTime};
11
12/// Represents the state of Windows CodecFiles
13#[derive(Deserialize, Serialize, Debug, Clone)]
14pub struct CodecFiles {
15 /// Represents sequence of Windows `CodecFiles`
16 pub codec_files: Vec<Win32_CodecFile>,
17 /// When was the record last updated
18 pub last_updated: SystemTime,
19}
20
21update!(CodecFiles, codec_files);
22
23/// The `Win32_CodecFile` WMI class represents the audio or video codec installed on the computer
24/// system. Codecs convert one media format type to another, typically a compressed format to an
25/// uncompressed format. The name "codec" is derived from a combination of compress and decompress.
26/// For example, a codec can convert a compressed format, such as MS-ADPCM, to an uncompressed
27/// format such as PCM, which most audio hardware can play directly.
28///
29/// <https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-codecfile>
30#[derive(Default, Deserialize, Serialize, Debug, Clone)]
31#[allow(non_snake_case)]
32#[allow(non_camel_case_types)]
33pub struct Win32_CodecFile {
34 /// Bitmask that represents the access rights required to access or perform specific operations
35 /// on the codec file. For bit values, see File and Directory Access Rights Constants.
36 ///
37 /// Note: On FAT volumes, the FULL_ACCESS value is returned instead, which indicates no security
38 /// has been set on the object.
39 ///
40 /// `FILE_READ_DATA` (file) or `FILE_LIST_DIRECTORY` (directory) (1)
41 /// `FILE_WRITE_DATA` (file) or `FILE_ADD_FILE` (directory) (2)
42 /// `FILE_APPEND_DATA` (file) or `FILE_ADD_SUBDIRECTORY` (directory) (4)
43 /// `FILE_READ_EA` (8)
44 /// `FILE_WRITE_EA` (16)
45 /// `FILE_EXECUTE` (file) or `FILE_TRAVERSE` (directory) (32)
46 /// `FILE_DELETE_CHILD` (directory) (64)
47 /// `FILE_READ_ATTRIBUTES` (128)
48 /// `FILE_WRITE_ATTRIBUTES` (256)
49 /// `DELETE` (65536)
50 /// `READ_CONTROL` (131072)
51 /// `WRITE_DAC` (262144)
52 /// `WRITE_OWNER` (524288)
53 /// `SYNCHRONIZE` (1048576)
54 pub AccessMask: Option<u32>,
55 /// If `True`, the file should be archived.
56 pub Archive: Option<bool>,
57 /// Short description of the object.
58 pub Caption: Option<String>,
59 /// If `True`, the file is compressed.
60 pub Compressed: Option<bool>,
61 /// Algorithm or tool used to compress the logical file. If it is not possible (or not desired) to
62 /// describe the compression scheme (perhaps because it is not known), use the following words:
63 /// "Unknown" to represent that it is not known whether the logical file is compressed or not;
64 /// "Compressed" to represent that the file is compressed but either its compression scheme is not
65 /// known or not disclosed; and "Not Compressed" to represent that the logical file is not compressed.
66 pub CompressionMethod: Option<String>,
67 /// Name of the first concrete class to appear in the inheritance chain used in the creation of an
68 /// instance. When used with the other key properties of the class, the property allows all instances
69 /// of this class and its subclasses to be uniquely identified.
70 pub CreationClassName: Option<String>,
71 /// File creation date.
72 pub CreationDate: Option<WMIDateTime>,
73 /// Class of the computer system.
74 pub CSCreationClassName: Option<String>,
75 /// String representing the name of the computer system.
76 pub CSName: Option<String>,
77 /// Full name of the codec driver. This string is intended to be displayed in large (descriptive) spaces.
78 ///
79 /// Example: "Microsoft PCM Converter"
80 pub Description: Option<String>,
81 /// Drive letter (including colon) of the file.
82 ///
83 /// Example: "c:"
84 pub Drive: Option<String>,
85 /// DOS-compatible file name for this file.
86 ///
87 /// Example: "c:\progra~1"
88 pub EightDotThreeFileName: Option<String>,
89 /// If `True`, the file is encrypted.
90 pub Encrypted: Option<bool>,
91 /// Algorithm or tool used to encrypt the logical file. If it is not possible (or not desired) to
92 /// describe the encryption scheme (perhaps for security reasons), use the following words: "Unknown"
93 /// to represent that it is not known whether the logical file is encrypted or not; "Encrypted" to
94 /// represent that the file is encrypted but either its encryption scheme is not known or not disclosed;
95 /// and "Not Encrypted" to represent that the logical file is not encrypted.
96 pub EncryptionMethod: Option<String>,
97 /// File name extension (without the dot).
98 ///
99 /// Examples: "txt", "mof", "mdb"
100 pub Extension: Option<String>,
101 /// Name (without the extension) of the file.
102 ///
103 /// Example: "autoexec"
104 pub FileName: Option<String>,
105 /// Size of the file (in bytes).
106 pub FileSize: Option<u64>,
107 /// File type (indicated by the `Extension` property).
108 pub FileType: Option<String>,
109 /// Class of the file system.
110 pub FSCreationClassName: Option<String>,
111 /// Name of the file system.
112 pub FSName: Option<String>,
113 /// Codec represented by this class.
114 ///
115 /// The values are:
116 /// - "Audio"
117 /// - "Video"
118 ///
119 /// `Audio` ("Audio")
120 ///
121 /// `Video` ("Video")
122 pub Group: Option<String>,
123 /// If `True`, the file is hidden.
124 pub Hidden: Option<bool>,
125 /// Object was installed. This property does not require a value to indicate that the object is installed.
126 pub InstallDate: Option<WMIDateTime>,
127 /// Number of "file opens" that are currently active against the file.
128 pub InUseCount: Option<u64>,
129 /// File was last accessed.
130 pub LastAccessed: Option<WMIDateTime>,
131 /// File was last modified.
132 pub LastModified: Option<WMIDateTime>,
133 /// Manufacturer string from version resource, if one is present.
134 pub Manufacturer: Option<String>,
135 /// Inherited name that serves as a key of a logical file instance within a file system. Full path names
136 /// should be provided.
137 ///
138 /// Example: "C:\Windows\system\win.ini"
139 pub Name: Option<String>,
140 /// Path of the file. This includes leading and trailing backslashes.
141 ///
142 /// Example: "\windows\system\"
143 pub Path: Option<String>,
144 /// File can be read.
145 pub Readable: Option<bool>,
146 /// Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states.
147 ///
148 /// Values include the following:
149 /// - `OK` ("OK")
150 /// - `Error` ("Error")
151 /// - `Degraded` ("Degraded")
152 /// - `Unknown` ("Unknown")
153 /// - `Pred Fail` ("Pred Fail")
154 /// - `Starting` ("Starting")
155 /// - `Stopping` ("Stopping")
156 /// - `Service` ("Service")
157 /// - `Stressed` ("Stressed")
158 /// - `NonRecover` ("NonRecover")
159 /// - `No Contact` ("No Contact")
160 /// - `Lost Comm` ("Lost Comm")
161 pub Status: Option<String>,
162 /// If `True`, the file is a system file.
163 pub System: Option<bool>,
164 /// Version string from version resource, if one is present.
165 pub Version: Option<String>,
166 /// If `True`, the file can be written.
167 pub Writeable: Option<bool>,
168}