Skip to content

Commit

Permalink
Merge pull request #26 from NidhiHemanth/master
Browse files Browse the repository at this point in the history
Documentation & Code Fixes
  • Loading branch information
sn99 authored May 26, 2023
2 parents 58179c7 + 126985a commit 9d7c94b
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 99 deletions.
4 changes: 2 additions & 2 deletions src/bin/get_fields.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// cargo run --bin get_fields --release

use wmi::*;
use wmi::{COMLibrary, WMIConnection};
use std::collections::HashMap;
use wmi::Variant;

pub fn main() {
let wmi_con = WMIConnection::new(COMLibrary::new().unwrap()).unwrap();
let results: Vec<HashMap<String, Variant>> = wmi_con.raw_query("SELECT * FROM Win32_ServerConnection").unwrap();

print!("{:?}", results);
print!("{results:?}");
}
2 changes: 1 addition & 1 deletion src/operating_system/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct Environments {

update!(Environments, environments);

/// Represents the state of Windows TimeZone
/// Represents the state of Windows `TimeZone`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TimeZones {
/// Sequence of windows TimeZone states
Expand Down
4 changes: 2 additions & 2 deletions src/operating_system/event_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
use std::time::SystemTime;
use wmi::{COMLibrary, WMIConnection, WMIDateTime};

/// Represents the state of Windows NTEventlogFiles
/// Represents the state of Windows `NTEventlogFiles`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NTEventlogFiles {
/// Represents data stored in a Windows Event log file
Expand All @@ -24,7 +24,7 @@ pub struct NTEventlogFiles {

update!(NTEventlogFiles, nt_event_log_files);

/// Represents the state of Windows NTLogEvents
/// Represents the state of Windows `NTLogEvents`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NTLogEvents {
/// Represents sequence of Windows `NTLogEvents`
Expand Down
18 changes: 9 additions & 9 deletions src/operating_system/file_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ update!(MappedLogicalDisks, mapped_logical_disks);
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct QuotaSettings {
/// Sequence of windows quota settings
pub quota_settings: Vec<Win32_MappedLogicalDisk>,
pub quota_settings: Vec<Win32_QuotaSetting>,
/// When was the record last updated
pub last_updated: SystemTime,
}
Expand Down Expand Up @@ -121,7 +121,7 @@ update!(Volumes, volumes);

/// The `Win32_Directory` WMI class represents a directory entry on a computer system running Windows.
/// A directory is a type of file that logically groups data files and provides path information for
/// the grouped files. Example: C:\TEMP. Win32_Directory does not include directories of network
/// the grouped files. Example: C:\TEMP. `Win32_Directory` does not include directories of network
/// drives.
///
/// <https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-directory>
Expand Down Expand Up @@ -271,25 +271,25 @@ pub struct Win32_Directory {
/// Directory resolution is performed as follows:
///
/// - Root destination directories:
/// The root directory entries are those with a null Directory_Parent value or a Directory_Parent value identical to the Directory value.
/// The root directory entries are those with a null `Directory_Parent` value or a `Directory_Parent` value identical to the Directory value.
/// The value in the Directory property is interpreted as the name of a property
/// defining the location of the destination directory.
/// If the property is defined, the destination directory is resolved to the property's value.
/// If the property is undefined, the ROOTDRIVE property is used instead to resolve the path.
/// - Root source directories:
/// The value of the DefaultDir column for root entries is interpreted as the name of a property
/// The value of the `DefaultDir` column for root entries is interpreted as the name of a property
/// defining the source location of this directory.
/// This property must be defined or an error will occur.
/// - Nonroot destination directories:
/// The Directory value for a nonroot directory is also interpreted as the name of a property
/// defining the location of the destination.
/// If the property is defined, the destination directory is resolved to the property's value.
/// If the property is not defined,
/// the destination directory is resolved to a subdirectory beneath the resolved destination directory for the Directory_Parent entry.
/// The DefaultDir value defines the name of the subdirectory.
/// the destination directory is resolved to a subdirectory beneath the resolved destination directory for the `Directory_Parent` entry.
/// The `DefaultDir` value defines the name of the subdirectory.
/// - Nonroot source directories:
/// The source directory for a nonroot directory is resolved to a subdirectory of the resolved source directory for the Directory_Parent entry.
/// Again, the DefaultDir value defines the name of the subdirectory.
/// The source directory for a nonroot directory is resolved to a subdirectory of the resolved source directory for the `Directory_Parent` entry.
/// Again, the `DefaultDir` value defines the name of the subdirectory.
///
/// <https://learn.microsoft.com/en-us/previous-versions/windows/desktop/msiprov/win32-directoryspecification>
#[derive(Default, Deserialize, Serialize, Debug, Clone)]
Expand Down Expand Up @@ -1475,7 +1475,7 @@ pub struct Win32_ShortcutFile {
/// A volume is formatted by using a file system, such as FAT or NTFS,
/// and might have a drive letter assigned to it.
/// One hard disk can have multiple volumes, and volumes can span multiple physical disks.
/// The Win32_Volume class does not support disk drive management.
/// The `Win32_Volume` class does not support disk drive management.
///
/// Windows XP and earlier: This class is not available.
///
Expand Down
14 changes: 7 additions & 7 deletions src/operating_system/job_objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use serde::{Deserialize, Serialize};
use std::time::SystemTime;
use wmi::{COMLibrary, WMIConnection};

/// Represents the state of Windows LUIDs
/// Represents the state of Windows `LUIDs`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct LUIDs {
/// Represents sequence of Windows `LUIDs`
Expand All @@ -33,18 +33,18 @@ pub struct LUIDs {

update!(LUIDs, luids);

/// Represents the state of Windows LUIDandAttributes
/// Represents the state of Windows `LUIDandAttributes`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct LUIDandAttributes {
/// Represents sequence of Windows `LUIDs`
/// Represents sequence of Windows `LUIDandAttributes`
pub luid_and_attributes: Vec<Win32_LUIDandAttributes>,
/// When was the record last updated
pub last_updated: SystemTime,
}

update!(LUIDandAttributes, luid_and_attributes);

/// Represents the state of Windows NamedJobObjects
/// Represents the state of Windows `NamedJobObjects`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NamedJobObjects {
/// Represents sequence of Windows `NamedJobObjects`
Expand All @@ -55,7 +55,7 @@ pub struct NamedJobObjects {

update!(NamedJobObjects, named_job_objects);

/// Represents the state of Windows NamedJobObjectActgInfos
/// Represents the state of Windows `NamedJobObjectActgInfos`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NamedJobObjectActgInfos {
/// Represents sequence of Windows `NamedJobObjectActgInfos`
Expand All @@ -66,7 +66,7 @@ pub struct NamedJobObjectActgInfos {

update!(NamedJobObjectActgInfos, named_job_object_actg_infos);

/// Represents the state of Windows NamedJobObjectLimitSettings
/// Represents the state of Windows `NamedJobObjectLimitSettings`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NamedJobObjectLimitSettings {
/// Represents sequence of Windows `NamedJobObjectLimitSettings`
Expand Down Expand Up @@ -204,7 +204,7 @@ pub struct Win32_NamedJobObjectActgInfo {
pub WriteTransferCount: Option<u64>,
}

/// The Win32_NamedJobObjectLimitSetting WMI class represents the limit settings for a job object.
/// The `Win32_NamedJobObjectLimitSetting` WMI class represents the limit settings for a job object.
///
/// <https://learn.microsoft.com/en-us/previous-versions/windows/desktop/wmipjobobjprov/win32-namedjobobjectlimitsetting>
#[derive(Default, Deserialize, Serialize, Debug, Clone)]
Expand Down
6 changes: 3 additions & 3 deletions src/operating_system/memory_and_pagefiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
use std::time::SystemTime;
use wmi::{COMLibrary, WMIConnection, WMIDateTime};

/// Represents the state of Windows PageFiles
/// Represents the state of Windows `PageFiles`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct PageFiles {
/// Represents sequence of Windows `PageFiles`
Expand All @@ -23,7 +23,7 @@ pub struct PageFiles {

update!(PageFiles, pagefiles);

/// Represents the state of Windows PageFileSettings
/// Represents the state of Windows `PageFileSettings`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct PageFileSettings {
/// Represents the Windows `PageFileSettings`
Expand All @@ -34,7 +34,7 @@ pub struct PageFileSettings {

update!(PageFileSettings, pagefile_settings);

/// Represents the state of Windows PageFileUsages
/// Represents the state of Windows `PageFileUsages`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct PageFileUsages {
/// Represents the Windows `PageFileUsages` details
Expand Down
2 changes: 1 addition & 1 deletion src/operating_system/multimedia_audio_visual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
use std::time::SystemTime;
use wmi::{COMLibrary, WMIConnection, WMIDateTime};

/// Represents the state of Windows CodecFiles
/// Represents the state of Windows `CodecFiles`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct CodecFiles {
/// Represents sequence of Windows `CodecFiles`
Expand Down
18 changes: 9 additions & 9 deletions src/operating_system/networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
use std::time::SystemTime;
use wmi::{COMLibrary, WMIConnection, WMIDateTime};

/// Represents the state of Windows IP4PersistedRouteTables
/// Represents the state of Windows `IP4PersistedRouteTables`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct IP4PersistedRouteTables {
/// Represents sequence of Windows `IP4PersistedRouteTables`
Expand All @@ -29,7 +29,7 @@ pub struct IP4PersistedRouteTables {

update!(IP4PersistedRouteTables, ip4_persisted_route_tables);

/// Represents the state of Windows IP4RouteTables
/// Represents the state of Windows `IP4RouteTables`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct IP4RouteTables {
/// Represents sequence of Windows `IP4RouteTables`
Expand All @@ -40,7 +40,7 @@ pub struct IP4RouteTables {

update!(IP4RouteTables, ip4_route_tables);

/// Represents the state of Windows NetworkClients
/// Represents the state of Windows `NetworkClients`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NetworkClients {
/// Represents sequence of Windows `NetworkClients`
Expand All @@ -51,7 +51,7 @@ pub struct NetworkClients {

update!(NetworkClients, nework_clients);

/// Represents the state of Windows NetworkConnections
/// Represents the state of Windows `NetworkConnections`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NetworkConnections {
/// Represents sequence of Windows `NetworkConnections`
Expand All @@ -62,7 +62,7 @@ pub struct NetworkConnections {

update!(NetworkConnections, nework_connections);

/// Represents the state of Windows NetworkProtocols
/// Represents the state of Windows `NetworkProtocols`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NetworkProtocols {
/// Represents sequence of Windows `NetworkProtocols`
Expand All @@ -73,7 +73,7 @@ pub struct NetworkProtocols {

update!(NetworkProtocols, nework_protocols);

/// Represents the state of Windows NTDomains
/// Represents the state of Windows `NTDomains`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NTDomains {
/// Represents sequence of Windows `NTDomains`
Expand All @@ -84,7 +84,7 @@ pub struct NTDomains {

update!(NTDomains, nt_domains);

/// Represents the state of Windows IP4RouteTableEvents
/// Represents the state of Windows `IP4RouteTableEvents`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct IP4RouteTableEvents {
/// Represents sequence of Windows `IP4RouteTableEvents`
Expand All @@ -102,7 +102,7 @@ update!(IP4RouteTableEvents, ip4_route_table_events);
///
/// Persistent entries are automatically inserted again in the route table each time the route table
/// is rebuilt. The operating system stores persistent routes in the registry. An entry can be removed
/// through the method call SWbemServices.Delete for scripting or IWbemServices::DeleteInstance for C++
/// through the method call SWbemServices.Delete for scripting or `IWbemServices::DeleteInstance` for C++
/// programming.
///
/// This class is only applicable to IPv4 and does not return IPX or IPv6 data.
Expand Down Expand Up @@ -513,7 +513,7 @@ pub struct Win32_NetworkProtocol {
pub SupportsQualityofService: Option<bool>,
}

/// The Win32_NTDomain WMI class represents a Windows domain.
/// The `Win32_NTDomain` WMI class represents a Windows domain.
///
/// <https://learn.microsoft.com/en-us/previous-versions/windows/desktop/cimwin32a/win32-ntdomain>
#[derive(Default, Deserialize, Serialize, Debug, Clone)]
Expand Down
20 changes: 10 additions & 10 deletions src/operating_system/operating_system_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use serde::{Deserialize, Serialize};
use std::time::SystemTime;
use wmi::{COMLibrary, WMIConnection, WMIDateTime};

/// Represents the state of Windows BootConfigurations
/// Represents the state of Windows `BootConfigurations`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct BootConfigurations {
/// Represents sequence of Windows `BootConfigurations`
Expand All @@ -46,7 +46,7 @@ pub struct BootConfigurations {

update!(BootConfigurations, boot_configurations);

/// Represents the state of Windows ComputerSystems
/// Represents the state of Windows `ComputerSystems`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ComputerSystems {
/// Represents sequence of Windows `ComputerSystems`
Expand All @@ -57,7 +57,7 @@ pub struct ComputerSystems {

update!(ComputerSystems, computer_systems);

/// Represents the state of Windows ComputerSystemProducts
/// Represents the state of Windows `ComputerSystemProducts`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ComputerSystemProducts {
/// Represents sequence of Windows `ComputerSystemProducts`
Expand All @@ -68,7 +68,7 @@ pub struct ComputerSystemProducts {

update!(ComputerSystemProducts, computer_system_products);

/// Represents the state of Windows LoadOrderGroups
/// Represents the state of Windows `LoadOrderGroups`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct LoadOrderGroups {
/// Represents sequence of Windows `LoadOrderGroups`
Expand All @@ -79,7 +79,7 @@ pub struct LoadOrderGroups {

update!(LoadOrderGroups, load_order_groups);

/// Represents the state of Windows OperatingSystems
/// Represents the state of Windows `OperatingSystems`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct OperatingSystems {
/// Represents sequence of Windows `OperatingSystems`
Expand All @@ -90,7 +90,7 @@ pub struct OperatingSystems {

update!(OperatingSystems, operating_systems);

/// Represents the state of Windows OSRecoveryConfigurations
/// Represents the state of Windows `OSRecoveryConfigurations`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct OSRecoveryConfigurations {
/// Represents sequence of Windows `OSRecoveryConfigurations`
Expand All @@ -101,7 +101,7 @@ pub struct OSRecoveryConfigurations {

update!(OSRecoveryConfigurations, os_recovery_configurations);

/// Represents the state of Windows QuickFixEngineerings
/// Represents the state of Windows `QuickFixEngineerings`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct QuickFixEngineerings {
/// Represents sequence of Windows `QuickFixEngineerings`
Expand All @@ -112,7 +112,7 @@ pub struct QuickFixEngineerings {

update!(QuickFixEngineerings, quick_fix_engineerings);

/// Represents the state of Windows StartupCommands
/// Represents the state of Windows `StartupCommands`
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct StartupCommands {
/// Represents sequence of Windows `StartupCommands`
Expand All @@ -123,7 +123,7 @@ pub struct StartupCommands {

update!(StartupCommands, startup_commands);

/// The Win32_BootConfiguration WMI class represents the boot configuration of a computer system running Windows.
/// The `Win32_BootConfiguration` WMI class represents the boot configuration of a computer system running Windows.
///
/// <https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-bootconfiguration>
#[derive(Default, Deserialize, Serialize, Debug, Clone)]
Expand Down Expand Up @@ -156,7 +156,7 @@ pub struct Win32_BootConfiguration {
pub TempDirectory: Option<String>,
}

/// The Win32_ComputerSystem WMI class represents a computer system running Windows.
/// The `Win32_ComputerSystem` WMI class represents a computer system running Windows.
///
/// <https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystem>
#[derive(Default, Deserialize, Serialize, Debug, Clone)]
Expand Down
6 changes: 3 additions & 3 deletions src/operating_system/product_activation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct Proxys {

update!(Proxys, proxys);

/// Represents the state of Windows WindowsProductActivations
/// Represents the state of Windows `WindowsProductActivations`
///
/// Note: this class doesn't exist anymore
#[derive(Deserialize, Serialize, Debug, Clone)]
Expand Down Expand Up @@ -60,7 +60,7 @@ pub struct Win32_Proxy {
pub SettingID: Option<String>,
}

/// The Win32_WindowsProductActivation WMI class contains properties and methods related to Windows
/// The `Win32_WindowsProductActivation` WMI class contains properties and methods related to Windows
/// Product Activation (WPA), such as activation state and grace period. This class also provides the
/// ability to activate the customer's computer online and offline.
///
Expand Down Expand Up @@ -97,6 +97,6 @@ pub struct Win32_WindowsProductActivation {
/// System whose WPA properties and methods are to be accessed. This property is a string that specifies
/// the name of the computer or its IP address.
pub ServerName: Option<String>,
/// Identifier by which the CIM_Setting object is known.
/// Identifier by which the `CIM_Setting` object is known.
pub SettingID: Option<String>,
}
Loading

0 comments on commit 9d7c94b

Please sign in to comment.