Expand description
Windows Registry operations.
This module provides ergonomic access to the Windows Registry with automatic handle management and type-safe value operations.
§Examples
§Basic Usage
use windows_erg::registry::{Hive, RegistryKey};
// Open a key
let key = RegistryKey::open(
Hive::LocalMachine,
r"SOFTWARE\Microsoft\Windows\CurrentVersion"
)?;
// Read a string value
let program_files: String = key.get_value("ProgramFilesDir")?;
// Create a new key and write values
let key = RegistryKey::create(Hive::CurrentUser, r"Software\MyApp")?;
key.set_value("Version", "1.0.0")?;
key.set_value("Count", 42u32)?;
// Enumerate subkeys
for subkey in key.subkeys()? {
println!("Subkey: {}", subkey);
}§Convenience Functions
use windows_erg::registry::{self, Hive};
// Quick read/write without opening a key
let version = registry::read_string(
Hive::LocalMachine,
r"SOFTWARE\Microsoft\Windows NT\CurrentVersion",
"ProductName"
)?;
registry::write_u32(Hive::CurrentUser, r"Software\MyApp", "Count", 42)?;§Advanced Key Opening
use windows_erg::registry::{Hive, RegistryKey};
// Open with WOW64 view and specific access
let key = RegistryKey::builder()
.hive(Hive::LocalMachine)
.path(r"SOFTWARE\MyApp")
.write()
.wow64_32()
.open()?;Structs§
- Registry
Key - A Windows Registry key with automatic handle management.
- Registry
KeyBuilder - Builder for opening registry keys with specific options.
Enums§
Traits§
- Registry
Value - Trait for types that can be read from and written to the registry.
Functions§
- apply_
permissions - Apply a permission edit plan to a registry key.
- read_
binary - Read binary data from the registry.
- read_
bool - Read a boolean value from the registry (stored as DWORD).
- read_
multi_ string - Read a multi-string value from the registry.
- read_
security_ descriptor - Read a registry key security descriptor.
- read_
string - Read a string value from the registry without opening a key.
- read_
u32 - Read a DWORD (u32) value from the registry.
- read_
u64 - Read a QWORD (u64) value from the registry.
- write_
binary - Write binary data to the registry.
- write_
bool - Write a boolean value to the registry (stored as DWORD).
- write_
multi_ string - Write a multi-string value to the registry.
- write_
security_ descriptor - Write a registry key security descriptor.
- write_
string - Write a string value to the registry without opening a key.
- write_
u32 - Write a DWORD (u32) value to the registry.
- write_
u64 - Write a QWORD (u64) value to the registry.