diff --git a/Cargo.toml b/Cargo.toml index 5378185..4d58cc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,5 +18,5 @@ default-target = "x86_64-pc-windows-msvc" [target.'cfg(target_os = "windows")'.dependencies] serde = "1.0.159" -wmi = "0.12.2" +wmi = { git = "https://github.com/NidhiHemanth/wmi-rs.git", rev = "bebdc1f969974181a76d54d1486e8602bc7e9720" } tokio = { version = "1.28.1", features = ["full"] } diff --git a/src/bin/snapshot.rs b/src/bin/snapshot.rs index 67564f8..07864c3 100644 --- a/src/bin/snapshot.rs +++ b/src/bin/snapshot.rs @@ -12,7 +12,8 @@ async fn main() { //k.update(); // for synchronous update // println!("{k:#?}"); - k.startup_commands.update(); + k.async_update().await; + // k.startup_commands.update(); - println!("{:#?}", k.startup_commands); + println!("{:#?}", k); } diff --git a/src/lib.rs b/src/lib.rs index 17925ff..d2ab07e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,11 +23,20 @@ //! } //! ``` +pub use std::collections::hash_map::DefaultHasher; +pub use std::hash::{Hash, Hasher}; + pub mod operating_system; pub mod state; pub use wmi::COMLibrary; +pub fn hash_vec(vec: &[T]) -> u64 { + let mut hasher = DefaultHasher::new(); + vec.hash(&mut hasher); + hasher.finish() +} + /// Macro to automatically make `update` and `async_update` for a given state field #[macro_export] macro_rules! update { @@ -40,7 +49,17 @@ macro_rules! update { let wmi_con = WMIConnection::new(com_con).unwrap(); self.last_updated = SystemTime::now(); + + let old_vec = self.$struct_field.clone(); self.$struct_field = wmi_con.query().unwrap(); + + if(self.$struct_field.len() != old_vec.len()) { + self.state_change = true; + } else if (crate::hash_vec(&(self.$struct_field)) != crate::hash_vec(&old_vec)) { + self.state_change = true; + } else { + self.state_change = false; + } } /// Update fields asynchronously @@ -50,7 +69,17 @@ macro_rules! update { let wmi_con = WMIConnection::new(com_con).unwrap(); self.last_updated = SystemTime::now(); + + let old_vec = self.$struct_field.clone(); self.$struct_field = wmi_con.async_query().await.unwrap(); + + if (self.$struct_field.len() != old_vec.len()) { + self.state_change = true; + } else if (crate::hash_vec(&(self.$struct_field)) != crate::hash_vec(&old_vec)) { + self.state_change = true; + } else { + self.state_change = false; + } } } @@ -60,6 +89,7 @@ macro_rules! update { $struct_name { $struct_field: Default::default(), last_updated: SystemTime::now(), + state_change: false, } } } diff --git a/src/operating_system/desktop.rs b/src/operating_system/desktop.rs index d220dfc..f0d504d 100644 --- a/src/operating_system/desktop.rs +++ b/src/operating_system/desktop.rs @@ -14,45 +14,65 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows user's desktops -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Desktops { /// Sequence of windows Desktop states pub desktops: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Desktops, desktops); /// Represents the state of Windows Environment -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Environments { /// Sequence of windows Environment states pub environments: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Environments, environments); /// Represents the state of Windows `TimeZone` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct TimeZones { /// Sequence of windows TimeZone states pub timezones: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(TimeZones, timezones); /// Represents the state of Windows User Desktops -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct UserDesktops { /// user account and desktop settings that are specific to it pub user_desktops: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(UserDesktops, user_desktops); @@ -61,7 +81,7 @@ update!(UserDesktops, user_desktops); /// properties of this class can be modified by the user to customize the desktop. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Desktop { @@ -141,7 +161,7 @@ pub struct Win32_Desktop { /// `HKEY_USERS\\Environment` /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Environment { @@ -208,7 +228,7 @@ pub struct Win32_Environment { /// which includes the changes required for transitioning to daylight saving time transition. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_TimeZone { @@ -366,7 +386,7 @@ pub struct Win32_TimeZone { /// are specific to it. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_UserDesktop { diff --git a/src/operating_system/drivers.rs b/src/operating_system/drivers.rs index 38b0d96..663d0e3 100644 --- a/src/operating_system/drivers.rs +++ b/src/operating_system/drivers.rs @@ -10,12 +10,17 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows Drivers -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Drivers { /// Sequence of Drivers based on when they were loaded in chronological order pub drivers: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Drivers, drivers); @@ -23,7 +28,7 @@ update!(Drivers, drivers); /// The `Win32_SystemDriver` WMI class represents a process on an operating system. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_SystemDriver { diff --git a/src/operating_system/event_log.rs b/src/operating_system/event_log.rs index b9bbd82..acd9f08 100644 --- a/src/operating_system/event_log.rs +++ b/src/operating_system/event_log.rs @@ -14,23 +14,33 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `NTEventlogFiles` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NTEventlogFiles { /// Represents data stored in a Windows Event log file pub nt_event_log_files: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NTEventlogFiles, nt_event_log_files); /// Represents the state of Windows `NTLogEvents` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NTLogEvents { /// Represents sequence of Windows `NTLogEvents` pub nt_log_events: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NTLogEvents, nt_log_events); @@ -39,7 +49,7 @@ update!(NTLogEvents, nt_log_events); /// events. The file is also known as the event log. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NTEventlogFile { @@ -190,7 +200,7 @@ pub struct Win32_NTEventlogFile { /// otherwise "Access Denied" is returned to the application. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NTLogEvent { diff --git a/src/operating_system/file_system.rs b/src/operating_system/file_system.rs index 5d191f1..66245aa 100644 --- a/src/operating_system/file_system.rs +++ b/src/operating_system/file_system.rs @@ -32,89 +32,129 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows Directories -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Directories { /// Sequence of windows directories pub directories: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Directories, directories); /// Represents the state of Windows Directory Specification -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct DirectorySpecifications { /// Sequence of windows directories specifications pub directory_specifications: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(DirectorySpecifications, directory_specifications); /// Represents the state of Windows Disk Partitions -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct DiskPartitions { /// Sequence of windows disk partitions pub disk_partitions: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(DiskPartitions, disk_partitions); /// Represents the state of Windows Logical Disks -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LogicalDisks { /// Sequence of windows logical disks pub logical_disks: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LogicalDisks, logical_disks); /// Represents the state of Windows Mapped Logical Disks -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct MappedLogicalDisks { /// Sequence of windows mapped logical disks pub mapped_logical_disks: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(MappedLogicalDisks, mapped_logical_disks); /// Represents the state of Windows Quota Settings -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct QuotaSettings { /// Sequence of windows quota settings pub quota_settings: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(QuotaSettings, quota_settings); /// Represents the state of Windows Shortcut Files -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ShortcutFiles { /// Sequence of windows shortcut files pub shortcut_files: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ShortcutFiles, shortcut_files); /// Represents the state of Windows Volumes -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Volumes { /// Sequence of windows volumes pub volumes: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Volumes, volumes); @@ -125,7 +165,7 @@ update!(Volumes, volumes); /// drives. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Directory { @@ -292,7 +332,7 @@ pub struct Win32_Directory { /// Again, the `DefaultDir` value defines the name of the subdirectory. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_DirectorySpecification { @@ -418,7 +458,7 @@ pub struct Win32_DirectorySpecification { /// /// // Some struct fields no longer exist -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_DiskPartition { @@ -732,7 +772,7 @@ pub struct Win32_DiskPartition { /// /// // Some struct fields no longer exist -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LogicalDisk { @@ -1061,7 +1101,7 @@ pub struct Win32_LogicalDisk { /// that are mapped as logical disks on the computer system. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_MappedLogicalDisk { @@ -1286,7 +1326,7 @@ pub struct Win32_MappedLogicalDisk { /// The `Win32_QuotaSetting` WMI class contains setting information for disk quotas on a volume. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_QuotaSetting { @@ -1328,7 +1368,7 @@ pub struct Win32_QuotaSetting { /// directories, and commands. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ShortcutFile { @@ -1482,7 +1522,7 @@ pub struct Win32_ShortcutFile { /// Note: This class has been repeated in Storage as well. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Volume { diff --git a/src/operating_system/job_objects.rs b/src/operating_system/job_objects.rs index 88cd5cf..d94a879 100644 --- a/src/operating_system/job_objects.rs +++ b/src/operating_system/job_objects.rs @@ -23,56 +23,81 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection}; /// Represents the state of Windows `LUIDs` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LUIDs { /// Represents sequence of Windows `LUIDs` pub luids: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LUIDs, luids); /// Represents the state of Windows `LUIDandAttributes` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LUIDandAttributes { /// Represents sequence of Windows `LUIDandAttributes` pub luid_and_attributes: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LUIDandAttributes, luid_and_attributes); /// Represents the state of Windows `NamedJobObjects` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NamedJobObjects { /// Represents sequence of Windows `NamedJobObjects` pub named_job_objects: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NamedJobObjects, named_job_objects); /// Represents the state of Windows `NamedJobObjectActgInfos` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NamedJobObjectActgInfos { /// Represents sequence of Windows `NamedJobObjectActgInfos` pub named_job_object_actg_infos: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NamedJobObjectActgInfos, named_job_object_actg_infos); /// Represents the state of Windows `NamedJobObjectLimitSettings` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NamedJobObjectLimitSettings { /// Represents sequence of Windows `NamedJobObjectLimitSettings` pub named_job_object_limit_settings: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NamedJobObjectLimitSettings, named_job_object_limit_settings); @@ -81,7 +106,7 @@ update!(NamedJobObjectLimitSettings, named_job_object_limit_settings); /// local computer that is used in security tokens. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LUID { @@ -95,7 +120,7 @@ pub struct Win32_LUID { /// Each LUID and attributes structure defines the availability of a security privilege. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LUIDandAttributes { @@ -111,7 +136,7 @@ pub struct Win32_LUIDandAttributes { /// instrumented. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NamedJobObject { @@ -140,7 +165,7 @@ pub struct Win32_NamedJobObject { /// The `Win32_NamedJobObjectActgInfo` WMI class class represents the I/O accounting information for a job object. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NamedJobObjectActgInfo { @@ -207,7 +232,7 @@ pub struct Win32_NamedJobObjectActgInfo { /// The `Win32_NamedJobObjectLimitSetting` WMI class represents the limit settings for a job object. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NamedJobObjectLimitSetting { diff --git a/src/operating_system/memory_and_pagefiles.rs b/src/operating_system/memory_and_pagefiles.rs index 0f42168..308ea09 100644 --- a/src/operating_system/memory_and_pagefiles.rs +++ b/src/operating_system/memory_and_pagefiles.rs @@ -13,34 +13,49 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `PageFiles` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct PageFiles { /// Represents sequence of Windows `PageFiles` pub pagefiles: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(PageFiles, pagefiles); /// Represents the state of Windows `PageFileSettings` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct PageFileSettings { /// Represents the Windows `PageFileSettings` pub pagefile_settings: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(PageFileSettings, pagefile_settings); /// Represents the state of Windows `PageFileUsages` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct PageFileUsages { /// Represents the Windows `PageFileUsages` details pub pagefile_usage: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(PageFileUsages, pagefile_usage); @@ -49,7 +64,7 @@ update!(PageFileUsages, pagefile_usage); /// on a Win32 system. This class has been deprecated. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_PageFile { @@ -184,7 +199,7 @@ pub struct Win32_PageFile { /// are different from the run-time state of a page file expressed through the associated class `Win32_PageFileUsage`. /// /// To create an instance of this class, enable the `SeCreatePagefilePrivilege` privilege. -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_PageFileSetting { @@ -211,7 +226,7 @@ pub struct Win32_PageFileSetting { /// The `Win32_PageFileUsage` WMI class represents the file used for handling virtual memory file swapping on /// a Win32 system. Information contained within objects instantiated from this class specify the run-time state /// of the page file. -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_PageFileUsage { diff --git a/src/operating_system/multimedia_audio_visual.rs b/src/operating_system/multimedia_audio_visual.rs index 5a0f11f..808cfe7 100644 --- a/src/operating_system/multimedia_audio_visual.rs +++ b/src/operating_system/multimedia_audio_visual.rs @@ -10,12 +10,17 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `CodecFiles` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct CodecFiles { /// Represents sequence of Windows `CodecFiles` pub codec_files: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(CodecFiles, codec_files); @@ -27,7 +32,7 @@ update!(CodecFiles, codec_files); /// format such as PCM, which most audio hardware can play directly. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_CodecFile { diff --git a/src/operating_system/networking.rs b/src/operating_system/networking.rs index 7e504f0..f580dc4 100644 --- a/src/operating_system/networking.rs +++ b/src/operating_system/networking.rs @@ -19,78 +19,113 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `IP4PersistedRouteTables` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct IP4PersistedRouteTables { /// Represents sequence of Windows `IP4PersistedRouteTables` pub ip4_persisted_route_tables: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(IP4PersistedRouteTables, ip4_persisted_route_tables); /// Represents the state of Windows `IP4RouteTables` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct IP4RouteTables { /// Represents sequence of Windows `IP4RouteTables` pub ip4_route_tables: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(IP4RouteTables, ip4_route_tables); /// Represents the state of Windows `NetworkClients` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NetworkClients { /// Represents sequence of Windows `NetworkClients` pub nework_clients: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NetworkClients, nework_clients); /// Represents the state of Windows `NetworkConnections` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NetworkConnections { /// Represents sequence of Windows `NetworkConnections` pub nework_connections: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NetworkConnections, nework_connections); /// Represents the state of Windows `NetworkProtocols` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NetworkProtocols { /// Represents sequence of Windows `NetworkProtocols` pub nework_protocols: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NetworkProtocols, nework_protocols); /// Represents the state of Windows `NTDomains` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NTDomains { /// Represents sequence of Windows `NTDomains` pub nt_domains: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NTDomains, nt_domains); /// Represents the state of Windows `IP4RouteTableEvents` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct IP4RouteTableEvents { /// Represents sequence of Windows `IP4RouteTableEvents` pub ip4_route_table_events: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(IP4RouteTableEvents, ip4_route_table_events); @@ -108,7 +143,7 @@ update!(IP4RouteTableEvents, ip4_route_table_events); /// This class is only applicable to IPv4 and does not return IPX or IPv6 data. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_IP4PersistedRouteTable { @@ -160,7 +195,7 @@ pub struct Win32_IP4PersistedRouteTable { /// This class is only applicable to IPv4 and does not return IPX or IPv6 data. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_IP4RouteTable { @@ -265,7 +300,7 @@ pub struct Win32_IP4RouteTable { /// with a client relationship to the system is a descendant (or member) of this class. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NetworkClient { @@ -310,7 +345,7 @@ pub struct Win32_NetworkClient { /// The `Win32_NetworkConnection` WMI classrepresents an active network connection in a Windows-based environment. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NetworkConnection { @@ -420,7 +455,7 @@ pub struct Win32_NetworkConnection { /// system. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NetworkProtocol { @@ -516,7 +551,7 @@ pub struct Win32_NetworkProtocol { /// The `Win32_NTDomain` WMI class represents a Windows domain. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NTDomain { @@ -606,7 +641,7 @@ pub struct Win32_NTDomain { /// Note: This class cannot be accessed. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] struct Win32_PingStatus { @@ -711,7 +746,7 @@ struct Win32_PingStatus { /// This class is only applicable to IP4 and does not return IPX or IP6 data. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_IP4RouteTableEvent { diff --git a/src/operating_system/operating_system_settings.rs b/src/operating_system/operating_system_settings.rs index c50604c..3696908 100644 --- a/src/operating_system/operating_system_settings.rs +++ b/src/operating_system/operating_system_settings.rs @@ -36,89 +36,129 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `BootConfigurations` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct BootConfigurations { /// Represents sequence of Windows `BootConfigurations` pub boot_configurations: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(BootConfigurations, boot_configurations); /// Represents the state of Windows `ComputerSystems` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ComputerSystems { /// Represents sequence of Windows `ComputerSystems` pub computer_systems: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ComputerSystems, computer_systems); /// Represents the state of Windows `ComputerSystemProducts` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ComputerSystemProducts { /// Represents sequence of Windows `ComputerSystemProducts` pub computer_system_products: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ComputerSystemProducts, computer_system_products); /// Represents the state of Windows `LoadOrderGroups` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LoadOrderGroups { /// Represents sequence of Windows `LoadOrderGroups` pub load_order_groups: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LoadOrderGroups, load_order_groups); /// Represents the state of Windows `OperatingSystems` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct OperatingSystems { /// Represents sequence of Windows `OperatingSystems` pub operating_systems: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(OperatingSystems, operating_systems); /// Represents the state of Windows `OSRecoveryConfigurations` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct OSRecoveryConfigurations { /// Represents sequence of Windows `OSRecoveryConfigurations` pub os_recovery_configurations: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(OSRecoveryConfigurations, os_recovery_configurations); /// Represents the state of Windows `QuickFixEngineerings` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct QuickFixEngineerings { /// Represents sequence of Windows `QuickFixEngineerings` pub quick_fix_engineerings: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(QuickFixEngineerings, quick_fix_engineerings); /// Represents the state of Windows `StartupCommands` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct StartupCommands { /// Represents sequence of Windows `StartupCommands` pub startup_commands: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(StartupCommands, startup_commands); @@ -126,7 +166,7 @@ update!(StartupCommands, startup_commands); /// The `Win32_BootConfiguration` WMI class represents the boot configuration of a computer system running Windows. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_BootConfiguration { @@ -159,7 +199,7 @@ pub struct Win32_BootConfiguration { /// The `Win32_ComputerSystem` WMI class represents a computer system running Windows. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ComputerSystem { @@ -572,7 +612,7 @@ pub struct Win32_ComputerSystem { /// computer system. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ComputerSystemProduct { @@ -605,7 +645,7 @@ pub struct Win32_ComputerSystemProduct { /// `HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ServiceGroupOrder` /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LoadOrderGroup { @@ -652,7 +692,7 @@ pub struct Win32_LoadOrderGroup { /// The `Win32_OperatingSystem` WMI class represents a Windows-based operating system installed on a computer. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_OperatingSystem { @@ -1219,7 +1259,7 @@ pub struct Win32_OperatingSystem { /// system crashes. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_OSRecoveryConfiguration { @@ -1278,7 +1318,7 @@ pub struct Win32_OSRecoveryConfiguration { /// supplied by Component Based Servicing (CBS). These updates are not listed in the registry. Updates supplied by /// Microsoft Windows Installer (MSI) or the Windows update site (https://update.microsoft.com) are not returned by /// `Win32_QuickFixEngineering`. -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_QuickFixEngineering { @@ -1334,7 +1374,7 @@ pub struct Win32_QuickFixEngineering { /// The `Win32_StartupCommand` WMI class represents a command that runs automatically when a user logs onto the /// computer system. -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_StartupCommand { diff --git a/src/operating_system/processes.rs b/src/operating_system/processes.rs index 05390ed..4497820 100644 --- a/src/operating_system/processes.rs +++ b/src/operating_system/processes.rs @@ -11,23 +11,33 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows Processes -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Processes { /// Sequence of Process based on when they were launched in chronological order pub processes: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Processes, processes); /// Represents the state of Windows threads -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Threads { /// Sequence of Threads based on when they were launched in chronological order pub threads: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Threads, threads); @@ -35,7 +45,7 @@ update!(Threads, threads); /// The `Win32_Process` WMI class represents a process on an operating system. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Process { @@ -230,7 +240,7 @@ pub struct Win32_Process { /// the same number of processes. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Thread { diff --git a/src/operating_system/product_activation.rs b/src/operating_system/product_activation.rs index 7783c80..f5e98af 100644 --- a/src/operating_system/product_activation.rs +++ b/src/operating_system/product_activation.rs @@ -14,12 +14,17 @@ use wmi::{COMLibrary, WMIConnection}; /// Represents the state of Windows Proxys /// /// Note: this class doesn't exist anymore -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Proxys { /// Represents sequence of Windows `Proxys` pub proxys: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Proxys, proxys); @@ -27,12 +32,17 @@ update!(Proxys, proxys); /// Represents the state of Windows `WindowsProductActivations` /// /// Note: this class doesn't exist anymore -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct WindowsProductActivations { /// Represents sequence of Windows `WindowsProductActivations` pub windows_product_activations: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(WindowsProductActivations, windows_product_activations); @@ -41,7 +51,7 @@ update!(WindowsProductActivations, windows_product_activations); /// connection related to Windows Product Activation (WPA). /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Proxy { @@ -65,7 +75,7 @@ pub struct Win32_Proxy { /// ability to activate the customer's computer online and offline. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_WindowsProductActivation { diff --git a/src/operating_system/registry.rs b/src/operating_system/registry.rs index 8ab0825..f051186 100644 --- a/src/operating_system/registry.rs +++ b/src/operating_system/registry.rs @@ -10,12 +10,17 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows Registry -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Registry { /// Sequence of Registry pub registries: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Registry, registries); @@ -23,7 +28,7 @@ update!(Registry, registries); /// The `Win32_Registry` WMI class represents a process on an operating system. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Registry { diff --git a/src/operating_system/scheduler_jobs.rs b/src/operating_system/scheduler_jobs.rs index 3d6519f..dafbdd5 100644 --- a/src/operating_system/scheduler_jobs.rs +++ b/src/operating_system/scheduler_jobs.rs @@ -11,34 +11,49 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `ScheduledJobs` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ScheduledJobs { /// Represents sequence of Windows `ScheduledJobs` pub scheduled_jobs: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ScheduledJobs, scheduled_jobs); /// Represents the state of Windows `LocalTimes` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LocalTimes { /// Represents sequence of Windows `LocalTimes` pub local_times: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LocalTimes, local_times); /// Represents the state of Windows `UTCTimes` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct UTCTimes { /// Represents sequence of Windows `UTCTimes` pub utc_times: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(UTCTimes, utc_times); @@ -49,7 +64,7 @@ update!(UTCTimes, utc_times); /// from the Control Panel. You cannot change a task created by WMI in the Scheduled Tasks UI. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ScheduledJob { @@ -192,7 +207,7 @@ pub struct Win32_ScheduledJob { /// Note: The smallest time segment supported is 1 second. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LocalTime { @@ -227,7 +242,7 @@ pub struct Win32_LocalTime { /// Note: The smallest time segment supported is a second. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_UTCTime { diff --git a/src/operating_system/security.rs b/src/operating_system/security.rs index b76a2d0..81dfeac 100644 --- a/src/operating_system/security.rs +++ b/src/operating_system/security.rs @@ -2,28 +2,28 @@ //! //! | Class | Description | //! |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| -//! | [**`Win32\_AccountSID**](/previous-versions/windows/desktop/secrcw32prov/win32-accountsid) | Association class
Relates a security account instance with a security descriptor instance.
| -//! | [**`Win32\_ACE**](/previous-versions/windows/desktop/secrcw32prov/win32-ace) | Instance class
Represents an access control entry (ACE).
| -//! | [**`Win32\_LogicalFileAccess**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfileaccess) | Association class
Relates the security settings of a file or directory and one member of its discretionary access control list (DACL).
| -//! | [**`Win32\_LogicalFileAuditing**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfileauditing) | Association class
Relates the security settings of a file or directory one member of its system access control list (SACL).
| -//! | [**`Win32\_LogicalFileGroup**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfilegroup) | Association class
Relates the security settings of a file or directory and its group.
| -//! | [**`Win32\_LogicalFileOwner**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfileowner) | Association class
Relates the security settings of a file or directory and its owner.
| -//! | [**`Win32\_LogicalFileSecuritySetting**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfilesecuritysetting) | Instance class
Represents security settings for a logical file.
| -//! | [**`Win32\_LogicalShareAccess**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalshareaccess) | Association class
Relates the security settings of a share and one member of its DACL.
| -//! | [**`Win32\_LogicalShareAuditing**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalshareauditing) | Association class
Relates the security settings of a share and one member of its SACL.
| -//! | [**`Win32\_LogicalShareSecuritySetting**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalsharesecuritysetting) | Instance class
Represents security settings for a logical file.
| -//! | [**`Win32\_PrivilegesStatus**](win32-privilegesstatus) | Instance class
Represents information about the privileges required to complete an operation.
| -//! | [**`Win32\_SecurityDescriptor**](/previous-versions/windows/desktop/secrcw32prov/win32-securitydescriptor) | Instance class
Represents a structural representation of a [**`SECURITY\_DESCRIPTO`R**](/windows/desktop/api/winnt/ns-winnt-security_descriptor).
| -//! | [**`Win32\_SecuritySetting**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysetting) | Instance class
Represents security settings for a managed element.
| -//! | [**`Win32\_SecuritySettingAccess**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingaccess) | Instance class
Represents the rights granted and denied to a trustee for a given object.
| -//! | [**`Win32\_SecuritySettingAuditing**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingauditing) | Instance class
Represents the auditing for a given trustee on a given object.
| -//! | [**`Win32\_SecuritySettingGroup**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettinggroup) | Association class
Relates the security of an object and its group.
| -//! | [**`Win32\_SecuritySettingOfLogicalFile**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingoflogicalfile) | Instance class
Represents security settings of a file or directory object.
| -//! | [**`Win32\_SecuritySettingOfLogicalShare**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingoflogicalshare) | Instance class
Represents security settings of a shared object.
| -//! | [**`Win32\_SecuritySettingOfObject**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingofobject) | Association class
Relates an object to its security settings.
| -//! | [**`Win32\_SecuritySettingOwner**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingowner) | Association class
Relates the security settings of an object and its owner.
| -//! | [**`Win32\_SID**](/previous-versions/windows/desktop/secrcw32prov/win32-sid) | Instance class
Represents an arbitrary SID.
| -//! | [**`Win32\_Trustee**](/previous-versions/windows/desktop/secrcw32prov/win32-trustee) | Instance class
Represents a trustee.
| +//! | [**Win32\_AccountSID**](/previous-versions/windows/desktop/secrcw32prov/win32-accountsid) | Association class
Relates a security account instance with a security descriptor instance.
| +//! | [**Win32\_ACE**](/previous-versions/windows/desktop/secrcw32prov/win32-ace) | Instance class
Represents an access control entry (ACE).
| +//! | [**Win32\_LogicalFileAccess**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfileaccess) | Association class
Relates the security settings of a file or directory and one member of its discretionary access control list (DACL).
| +//! | [**Win32\_LogicalFileAuditing**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfileauditing) | Association class
Relates the security settings of a file or directory one member of its system access control list (SACL).
| +//! | [**Win32\_LogicalFileGroup**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfilegroup) | Association class
Relates the security settings of a file or directory and its group.
| +//! | [**Win32\_LogicalFileOwner**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfileowner) | Association class
Relates the security settings of a file or directory and its owner.
| +//! | [**Win32\_LogicalFileSecuritySetting**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalfilesecuritysetting) | Instance class
Represents security settings for a logical file.
| +//! | [**Win32\_LogicalShareAccess**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalshareaccess) | Association class
Relates the security settings of a share and one member of its DACL.
| +//! | [**Win32\_LogicalShareAuditing**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalshareauditing) | Association class
Relates the security settings of a share and one member of its SACL.
| +//! | [**Win32\_LogicalShareSecuritySetting**](/previous-versions/windows/desktop/secrcw32prov/win32-logicalsharesecuritysetting) | Instance class
Represents security settings for a logical file.
| +//! | [**Win32\_PrivilegesStatus**](win32-privilegesstatus) | Instance class
Represents information about the privileges required to complete an operation.
| +//! | [**Win32\_SecurityDescriptor**](/previous-versions/windows/desktop/secrcw32prov/win32-securitydescriptor) | Instance class
Represents a structural representation of a [**`SECURITY\_DESCRIPTO`R**](/windows/desktop/api/winnt/ns-winnt-security_descriptor).
| +//! | [**Win32\_SecuritySetting**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysetting) | Instance class
Represents security settings for a managed element.
| +//! | [**Win32\_SecuritySettingAccess**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingaccess) | Instance class
Represents the rights granted and denied to a trustee for a given object.
| +//! | [**Win32\_SecuritySettingAuditing**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingauditing) | Instance class
Represents the auditing for a given trustee on a given object.
| +//! | [**Win32\_SecuritySettingGroup**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettinggroup) | Association class
Relates the security of an object and its group.
| +//! | [**Win32\_SecuritySettingOfLogicalFile**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingoflogicalfile) | Instance class
Represents security settings of a file or directory object.
| +//! | [**Win32\_SecuritySettingOfLogicalShare**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingoflogicalshare) | Instance class
Represents security settings of a shared object.
| +//! | [**Win32\_SecuritySettingOfObject**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingofobject) | Association class
Relates an object to its security settings.
| +//! | [**Win32\_SecuritySettingOwner**](/previous-versions/windows/desktop/secrcw32prov/win32-securitysettingowner) | Association class
Relates the security settings of an object and its owner.
| +//! | [**Win32\_SID**](/previous-versions/windows/desktop/secrcw32prov/win32-sid) | Instance class
Represents an arbitrary SID.
| +//! | [**Win32\_Trustee**](/previous-versions/windows/desktop/secrcw32prov/win32-trustee) | Instance class
Represents a trustee.
| use crate::update; use serde::{Deserialize, Serialize}; @@ -31,78 +31,113 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection}; /// Represents the state of Windows ACEs -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ACEs { /// Represents sequence of Windows `ACEs` pub aces: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ACEs, aces); /// Represents the state of Windows `LogicalFileSecuritySettings` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LogicalFileSecuritySettings { /// Represents sequence of Windows `LogicalFileSecuritySettings` pub logical_file_security_settings: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LogicalFileSecuritySettings, logical_file_security_settings); /// Represents the state of Windows `LogicalShareSecuritySettings` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LogicalShareSecuritySettings { /// Represents sequence of Windows `LogicalShareSecuritySettings` pub logical_share_security_settings: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LogicalShareSecuritySettings, logical_share_security_settings); /// Represents the state of Windows `PrivilegesStatuses` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct PrivilegesStatuses { /// Represents sequence of Windows `PrivilegesStatuses` pub privileges_statuses: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(PrivilegesStatuses, privileges_statuses); /// Represents the state of Windows `SecurityDescriptors` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct SecurityDescriptors { /// Represents sequence of Windows `SecurityDescriptors` pub security_descriptors: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(SecurityDescriptors, security_descriptors); /// Represents the state of Windows `SecuritySettings` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct SecuritySettings { /// Represents sequence of Windows `SecuritySettings` pub security_settings: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(SecuritySettings, security_settings); /// Represents the state of Windows Trustees -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Trustees { /// Represents sequence of Windows `Trustees` pub trustees: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Trustees, trustees); @@ -112,7 +147,7 @@ update!(Trustees, trustees); /// is specific to WMI allows logon, remote access, method execution, and writing to the WMI repository. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ACE { @@ -163,7 +198,7 @@ pub struct Win32_ACE { /// You cannot enumerate instances of this class. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LogicalFileSecuritySetting { @@ -199,7 +234,7 @@ pub struct Win32_LogicalFileSecuritySetting { /// The `Win32_LogicalShareSecuritySetting` WMI class represents security settings for a logical file. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LogicalShareSecuritySetting { @@ -236,7 +271,7 @@ pub struct Win32_LogicalShareSecuritySetting { /// has been returned. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_PrivilegesStatus { @@ -274,7 +309,7 @@ pub struct Win32_PrivilegesStatus { /// that controls the logging of attempts to access the object. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_SecurityDescriptor { @@ -312,7 +347,7 @@ pub struct Win32_SecurityDescriptor { /// The `Win32_SecuritySetting` abstract WMI class represents security settings for a managed element. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_SecuritySetting { @@ -346,7 +381,7 @@ pub struct Win32_SecuritySetting { /// identifier (SID) byte array. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Trustee { @@ -376,7 +411,7 @@ pub struct Win32_Trustee { /// Note: This class cannot be accessed. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] struct Win32_SID { diff --git a/src/operating_system/services.rs b/src/operating_system/services.rs index acfaf9f..1196930 100644 --- a/src/operating_system/services.rs +++ b/src/operating_system/services.rs @@ -10,12 +10,17 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows Drivers -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Services { /// Sequence of Drivers based on when they were loaded in chronological order pub services: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Services, services); @@ -23,7 +28,7 @@ update!(Services, services); /// The `Win32_Service` WMI class represents a process on an operating system. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Service { diff --git a/src/operating_system/shares.rs b/src/operating_system/shares.rs index e86e35f..9a8f41f 100644 --- a/src/operating_system/shares.rs +++ b/src/operating_system/shares.rs @@ -20,34 +20,49 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `ServerConnections` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ServerConnections { /// Represents sequence of Windows `ServerConnections` pub server_connections: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ServerConnections, server_connections); /// Represents the state of Windows `ServerSessions` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ServerSessions { /// Represents sequence of Windows `ServerSessions` pub server_sessions: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ServerSessions, server_sessions); /// Represents the state of Windows `Shares` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Shares { /// Represents sequence of Windows `Shares` pub shares: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Shares, shares); @@ -56,7 +71,7 @@ update!(Shares, shares); /// to a shared resource on the local computer. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ServerConnection { @@ -114,7 +129,7 @@ pub struct Win32_ServerConnection { /// local computer by users on a remote computer. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ServerSession { @@ -179,7 +194,7 @@ pub struct Win32_ServerSession { /// may be a disk drive, printer, interprocess communication, or other sharable device. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Share { diff --git a/src/operating_system/software_license_provider.rs b/src/operating_system/software_license_provider.rs index 6af5175..378e66f 100644 --- a/src/operating_system/software_license_provider.rs +++ b/src/operating_system/software_license_provider.rs @@ -12,34 +12,49 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `SoftwareLicensingProducts` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct SoftwareLicensingProducts { /// Represents data stored in a Windows SoftwareLicensingProducts pub software_licensing_products: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(SoftwareLicensingProducts, software_licensing_products); /// Represents the state of Windows `SoftwareLicensingServices` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct SoftwareLicensingServices { /// Represents data stored in a Windows SoftwareLicensingServices pub software_licensing_services: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(SoftwareLicensingServices, software_licensing_services); /// Represents the state of Windows `SoftwareLicensingTokenActivationLicenses` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct SoftwareLicensingTokenActivationLicenses { /// Represents data stored in a Windows SoftwareLicensingTokenActivationLicenses pub software_licensing_token_activation_licenses: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(SoftwareLicensingTokenActivationLicenses, software_licensing_token_activation_licenses); @@ -47,7 +62,7 @@ update!(SoftwareLicensingTokenActivationLicenses, software_licensing_token_activ /// This class exposes the product-specific properties and methods of the Software Licensing service. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct SoftwareLicensingProduct { @@ -173,7 +188,7 @@ pub struct SoftwareLicensingProduct { /// This class exposes the product-independent properties and methods of the Software Licensing service. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct SoftwareLicensingService { @@ -271,7 +286,7 @@ pub struct SoftwareLicensingService { /// This class exposes properties of installed token-based activation licenses. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct SoftwareLicensingTokenActivationLicense { diff --git a/src/operating_system/start_menu.rs b/src/operating_system/start_menu.rs index 64cd2eb..ea1a61b 100644 --- a/src/operating_system/start_menu.rs +++ b/src/operating_system/start_menu.rs @@ -15,34 +15,49 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `LogicalProgramGroups` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LogicalProgramGroups { /// Represents sequence of Windows `LogicalProgramGroups` pub logical_program_groups: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LogicalProgramGroups, logical_program_groups); /// Represents the state of Windows `LogicalProgramGroupItems` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LogicalProgramGroupItems { /// Represents sequence of Windows `LogicalProgramGroupItems` pub logical_program_group_items: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LogicalProgramGroupItems, logical_program_group_items); /// Represents the state of Windows `ProgramGroupOrItems` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ProgramGroupOrItems { /// Represents sequence of Windows `ProgramGroupOrItems` pub program_group_or_items: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ProgramGroupOrItems, program_group_or_items); @@ -51,7 +66,7 @@ update!(ProgramGroupOrItems, program_group_or_items); /// Windows. For example, Accessories or Startup. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LogicalProgramGroup { @@ -106,7 +121,7 @@ pub struct Win32_LogicalProgramGroup { /// that is not also another `Win32_LogicalProgramGroup` instance. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LogicalProgramGroupItem { @@ -152,7 +167,7 @@ pub struct Win32_LogicalProgramGroupItem { /// user's `Start\Programs` menu. It contains program groups and program group items. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ProgramGroupOrItem { diff --git a/src/operating_system/storage.rs b/src/operating_system/storage.rs index 5d19328..eadace5 100644 --- a/src/operating_system/storage.rs +++ b/src/operating_system/storage.rs @@ -20,45 +20,65 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows `ShadowCopys` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ShadowCopys { /// Represents sequence of `ShadowCopys` pub shadow_copys: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ShadowCopys, shadow_copys); /// Represents the state of Windows `Volumes` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Volumes { /// Represents sequence of `Volumes` pub volumes: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Volumes, volumes); /// Represents the state of Windows `ShadowContexts` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ShadowContexts { /// Represents sequence of `ShadowContexts` pub shadow_contexts: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ShadowContexts, shadow_contexts); /// Represents the state of Windows `ShadowProviders` -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct ShadowProviders { /// Represents sequence of `ShadowProviders` pub shadow_providers: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(ShadowProviders, shadow_providers); @@ -67,7 +87,7 @@ update!(ShadowProviders, shadow_providers); /// original volume at a previous time. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ShadowCopy { @@ -179,7 +199,7 @@ pub struct Win32_ShadowCopy { /// Note: This class has been repeated in File System as well. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Volume { @@ -421,7 +441,7 @@ pub struct Win32_Volume { /// and the degree of writer involvement. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ShadowContext { @@ -463,7 +483,7 @@ pub struct Win32_ShadowContext { /// and kernel or firmware implementation, that creates and represents volume shadow copies. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_ShadowProvider { diff --git a/src/operating_system/users.rs b/src/operating_system/users.rs index 6839113..cc40a0d 100644 --- a/src/operating_system/users.rs +++ b/src/operating_system/users.rs @@ -19,67 +19,97 @@ use std::time::SystemTime; use wmi::{COMLibrary, WMIConnection, WMIDateTime}; /// Represents the state of Windows User Accounts -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct UserAccounts { /// Sequence of windows User Accounts pub user_accounts: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(UserAccounts, user_accounts); /// Represents the state of Windows user accounts and group accounts -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Accounts { /// Sequence of windows Accounts pub accounts: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Accounts, accounts); /// Represents the state of Windows data about a group account -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct Groups { /// Sequence of windows Group pub groups: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(Groups, groups); /// Represents the state of Windows data about logon session or sessions associated with a user logged -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct LogonSessions { /// Sequence of windows logon sessions pub logon_sessions: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(LogonSessions, logon_sessions); /// Represents the state of Windows data about network login information -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct NetworkLoginProfiles { /// Sequence of windows network login pub network_login_profiles: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(NetworkLoginProfiles, network_login_profiles); /// Represents the state of Windows system accounts. -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone, Hash)] pub struct SystemAccounts { /// Sequence of windows SystemAccounts pub system_accounts: Vec, /// When was the record last updated pub last_updated: SystemTime, + /// Signifies change in state + /// + /// - TRUE : The state changed since last UPDATE + /// - FALSE : The state is the same as last UPDATE + pub state_change: bool, } update!(SystemAccounts, system_accounts); @@ -92,7 +122,7 @@ update!(SystemAccounts, system_accounts); /// instance has less impact. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_UserAccount { @@ -195,7 +225,7 @@ pub struct Win32_UserAccount { /// User or group names recognized by a Windows domain are descendants (or members) of this class. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Account { @@ -272,7 +302,7 @@ pub struct Win32_Account { /// Example: Marketing2. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_Group { @@ -350,7 +380,7 @@ pub struct Win32_Group { /// logged on to a computer system running Windows. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_LogonSession { @@ -421,7 +451,7 @@ pub struct Win32_LogonSession { /// access privileges, disk quotas, and logon directory paths. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_NetworkLoginProfile { @@ -633,7 +663,7 @@ pub struct Win32_NetworkLoginProfile { /// that the system account has the same functional privileges as the administrator account. /// /// -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] pub struct Win32_SystemAccount { diff --git a/src/state.rs b/src/state.rs index 17080e0..9c830b8 100644 --- a/src/state.rs +++ b/src/state.rs @@ -9,7 +9,7 @@ use tokio::join; /// Our main struct /// /// Holds the state/snapshot of Windows -#[derive(Default, Deserialize, Serialize, Debug, Clone)] +#[derive(Default, Deserialize, Serialize, Debug, Clone, Hash)] pub struct Windows { /// State of Windows Processes pub processes: processes::Processes,