9 releases (5 breaking)

new 0.5.1 Mar 18, 2025
0.4.0 Jan 7, 2025
0.3.0 Sep 25, 2024
0.2.0 Jul 3, 2024
0.1.0 Feb 22, 2024

#90 in Windows APIs

Download history 435045/week @ 2024-12-01 541792/week @ 2024-12-08 523844/week @ 2024-12-15 213642/week @ 2024-12-22 313537/week @ 2024-12-29 585218/week @ 2025-01-05 744994/week @ 2025-01-12 623631/week @ 2025-01-19 692993/week @ 2025-01-26 737543/week @ 2025-02-02 781064/week @ 2025-02-09 702626/week @ 2025-02-16 752142/week @ 2025-02-23 1083391/week @ 2025-03-02 1064330/week @ 2025-03-09 1214888/week @ 2025-03-16

4,161,974 downloads per month
Used in 6,532 crates (18 directly)

MIT/Apache

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

Dependencies