8 releases (5 breaking)
new 0.5.0 | Feb 21, 2025 |
---|---|
0.4.0 | Jan 7, 2025 |
0.3.0 | Sep 25, 2024 |
0.2.0 | Jul 3, 2024 |
0.0.0 | Feb 15, 2024 |
#119 in Windows APIs
2,737,650 downloads per month
Used in 6,166 crates
(16 directly)
110KB
2.5K
SLoC
Windows registry
The windows-registry crate provides simple, safe, and efficient access to the Windows registry.
Start by adding the following to your Cargo.toml file:
[dependencies.windows-registry]
version = "0.5"
Read and write registry keys and values as needed:
use windows_registry::*;
fn main() -> Result<()> {
let key = CURRENT_USER.create("software\\windows-rs")?;
key.set_u32("number", 123)?;
key.set_string("name", "Rust")?;
println!("{}", key.get_u32("number")?);
println!("{}", key.get_string("name")?);
Ok(())
}
Use the options()
method for even more control:
use windows_registry::*;
fn main() -> Result<()> {
let tx = Transaction::new()?;
let key = CURRENT_USER
.options()
.read()
.write()
.create()
.transaction(&tx)
.open("software\\windows-rs")?;
key.set_u32("name", 123)?;
tx.commit()?;
Ok(())
}