Skip to main content

VirtualRegistry

Struct VirtualRegistry 

Source
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

Source

pub fn new() -> Self

Source

pub fn set_value(&mut self, key_path: &str, name: &str, value: RegistryValue)

Set a value on a key, creating the key if absent.

Source

pub fn get_value(&self, key_path: &str, name: &str) -> Option<&RegistryValue>

Read a value by (key, name). Case-insensitive.

Source

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.

Source

pub fn contains_key(&self, key_path: &str) -> bool

True iff the named key exists.

Source

pub fn predefined_path(hkey: u32) -> Option<&'static str>

Resolve a predefined hive handle to its canonical path string.

Source

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.

Source

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.

Source

pub fn owns(&self, hkey: u32) -> bool

True iff hkey was minted by this registry (and still open). Used by the Win32 stubs to disambiguate registry handles from VFS / heap / event handles when CloseHandle is called.

Source

pub fn path_of(&self, hkey: u32) -> Option<&str>

Map an open handle back to its canonical key path. Returns None if hkey isn’t known.

Trait Implementations§

Source§

impl Clone for VirtualRegistry

Source§

fn clone(&self) -> VirtualRegistry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VirtualRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VirtualRegistry

Source§

fn default() -> VirtualRegistry

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.