Skip to content

Commit

Permalink
Update to windows-sys 0.52.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Jan 29, 2024
1 parent d0f9924 commit 3731f2f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ categories = ["os::windows-apis", "external-ffi-bindings"]
edition = "2021"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.48.0"
version = "0.52.0"
features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
"Win32_System_Console",
"Win32_System_SystemInformation",
]

[package.metadata.docs.rs]
Expand Down
28 changes: 18 additions & 10 deletions src/sysinfo.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::{ffi::OsString, io};

use winapi::um::sysinfoapi::{GetComputerNameExW, COMPUTER_NAME_FORMAT};
use windows_sys::Win32::System::SystemInformation::{
GetComputerNameExW, COMPUTER_NAME_FORMAT,
};

/// The type of name to be retrieved by [`get_computer_name`].
#[derive(Clone, Copy, Debug)]
Expand Down Expand Up @@ -49,19 +51,25 @@ pub enum ComputerNameKind {
impl ComputerNameKind {
fn to_format(&self) -> COMPUTER_NAME_FORMAT {
use self::ComputerNameKind::*;
use winapi::um::sysinfoapi;
use windows_sys::Win32::System::SystemInformation;

match *self {
DnsDomain => sysinfoapi::ComputerNameDnsDomain,
DnsFullyQualified => sysinfoapi::ComputerNameDnsFullyQualified,
DnsHostname => sysinfoapi::ComputerNameDnsHostname,
NetBios => sysinfoapi::ComputerNameNetBIOS,
PhysicalDnsDomain => sysinfoapi::ComputerNamePhysicalDnsDomain,
DnsDomain => SystemInformation::ComputerNameDnsDomain,
DnsFullyQualified => {
SystemInformation::ComputerNameDnsFullyQualified
}
DnsHostname => SystemInformation::ComputerNameDnsHostname,
NetBios => SystemInformation::ComputerNameNetBIOS,
PhysicalDnsDomain => {
SystemInformation::ComputerNamePhysicalDnsDomain
}
PhysicalDnsFullyQualified => {
sysinfoapi::ComputerNamePhysicalDnsFullyQualified
SystemInformation::ComputerNamePhysicalDnsFullyQualified
}
PhysicalDnsHostname => {
SystemInformation::ComputerNamePhysicalDnsHostname
}
PhysicalDnsHostname => sysinfoapi::ComputerNamePhysicalDnsHostname,
PhysicalNetBios => sysinfoapi::ComputerNamePhysicalNetBIOS,
PhysicalNetBios => SystemInformation::ComputerNamePhysicalNetBIOS,
}
}
}
Expand Down

0 comments on commit 3731f2f

Please sign in to comment.