Crates.io | windows-registry |
lib.rs | windows-registry |
version | |
source | src |
created_at | 2024-02-15 05:27:39.377652+00 |
updated_at | 2025-03-18 14:26:40.290086+00 |
description | Windows registry |
homepage | |
repository | https://github.com/microsoft/windows-rs |
max_upload_size | |
id | 1140682 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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(())
}