10 releases (5 breaking)

new 0.5.2 May 15, 2025
0.5.1 Mar 18, 2025
0.5.0 Feb 21, 2025
0.3.0 Sep 25, 2024
0.1.0 Feb 22, 2024

#226 in Windows APIs

Download history 678338/week @ 2025-01-24 733827/week @ 2025-01-31 775162/week @ 2025-02-07 693955/week @ 2025-02-14 769645/week @ 2025-02-21 977667/week @ 2025-02-28 1100151/week @ 2025-03-07 1115252/week @ 2025-03-14 1716801/week @ 2025-03-21 905652/week @ 2025-03-28 999970/week @ 2025-04-04 865202/week @ 2025-04-11 753489/week @ 2025-04-18 770495/week @ 2025-04-25 833634/week @ 2025-05-02 756546/week @ 2025-05-09

3,243,592 downloads per month
Used in 7,395 crates (21 directly)

MIT/Apache

105KB
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(())
}

Dependencies