9 releases (5 breaking)

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

#151 in Windows APIs

Download history 219788/week @ 2024-12-23 311653/week @ 2024-12-30 601069/week @ 2025-01-06 744560/week @ 2025-01-13 616561/week @ 2025-01-20 696875/week @ 2025-01-27 736117/week @ 2025-02-03 786652/week @ 2025-02-10 699122/week @ 2025-02-17 750312/week @ 2025-02-24 1092054/week @ 2025-03-03 1069886/week @ 2025-03-10 1345907/week @ 2025-03-17 1445286/week @ 2025-03-24 933091/week @ 2025-03-31 945403/week @ 2025-04-07

4,717,633 downloads per month
Used in 6,966 crates (19 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