diff --git a/Cargo.toml b/Cargo.toml index ecd1279..f91f63a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ hostname = "^0.3" sysctl = "^0.4" [target.'cfg(target_os = "windows")'.dependencies] -winreg = "^0.8" +windows-registry = "^0.2" [dev-dependencies] criterion = "0.3" diff --git a/src/machine_id.rs b/src/machine_id.rs index ff5f5e6..5c4da52 100644 --- a/src/machine_id.rs +++ b/src/machine_id.rs @@ -54,10 +54,11 @@ fn machine_id() -> Result { // https://github.com/rs/xid/blob/efa678f304ab65d6d57eedcb086798381ae22206/hostid_windows.go #[cfg(target_os = "windows")] fn machine_id() -> std::io::Result { - let hklm = winreg::RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE); - let guid: String = hklm - .open_subkey("SOFTWARE\\Microsoft\\Cryptography")? - .get_value("MachineGuid")?; + use windows_registry::*; + + let guid = LOCAL_MACHINE + .open("SOFTWARE\\Microsoft\\Cryptography")? + .get_string("MachineGuid")?; Ok(guid) }