pub struct VirtualRegistry { /* private fields */ }Expand description
In-memory Windows registry tree. Keys are referenced by
their full path ("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft").
Each key holds a set of named values; the value names are
matched case-insensitively per the Win32 contract.
The handle space is local to the registry; opened keys
return synthetic HKEY values starting at
HKEY_USER_BASE. The four predefined hive roots
(HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER,
HKEY_CLASSES_ROOT, HKEY_USERS) live at
HKLM / HKCU / HKCR / HKU respectively.
Implementations§
Source§impl VirtualRegistry
impl VirtualRegistry
pub fn new() -> Self
Sourcepub fn set_value(&mut self, key_path: &str, name: &str, value: RegistryValue)
pub fn set_value(&mut self, key_path: &str, name: &str, value: RegistryValue)
Set a value on a key, creating the key if absent.
Sourcepub fn get_value(&self, key_path: &str, name: &str) -> Option<&RegistryValue>
pub fn get_value(&self, key_path: &str, name: &str) -> Option<&RegistryValue>
Read a value by (key, name). Case-insensitive.
Sourcepub fn all_values(&self) -> impl Iterator<Item = (&str, &str, &RegistryValue)>
pub fn all_values(&self) -> impl Iterator<Item = (&str, &str, &RegistryValue)>
Iterate every (key_path, value_name, value) triple in
the virtual registry. Suitable for “what did the guest
write?” reports.
Sourcepub fn contains_key(&self, key_path: &str) -> bool
pub fn contains_key(&self, key_path: &str) -> bool
True iff the named key exists.
Sourcepub fn predefined_path(hkey: u32) -> Option<&'static str>
pub fn predefined_path(hkey: u32) -> Option<&'static str>
Resolve a predefined hive handle to its canonical path string.
Sourcepub fn open_key(&mut self, base_hkey: u32, subkey: &str) -> Option<u32>
pub fn open_key(&mut self, base_hkey: u32, subkey: &str) -> Option<u32>
Open a subkey under base_hkey (which may be a
predefined hive or a previously-returned user handle).
Returns None if the key doesn’t exist.
Sourcepub fn close_key(&mut self, hkey: u32) -> bool
pub fn close_key(&mut self, hkey: u32) -> bool
Close a previously-opened handle. Predefined hives
(HKLM etc.) are tolerated — the call is a no-op.
Returns true if the handle was a user handle that
was closed.
Trait Implementations§
Source§impl Clone for VirtualRegistry
impl Clone for VirtualRegistry
Source§fn clone(&self) -> VirtualRegistry
fn clone(&self) -> VirtualRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more