Skip to main content

KeyNode

Struct KeyNode 

Source
pub struct KeyNode {
Show 26 fields pub signature: [u8; 2], pub flags: u16, pub last_written: u64, pub access_bits: u8, pub layered_key_flags: u8, pub access_spare: u16, pub parent: u32, pub num_subkeys: u32, pub num_volatile_subkeys: u32, pub subkeys_list_offset: u32, pub volatile_subkeys_list_offset: u32, pub num_values: u32, pub values_list_offset: u32, pub security_offset: u32, pub class_name_offset: u32, pub largest_subkey_name_length: u16, pub virtualization_flags: u8, pub user_flags: u8, pub debug: u8, pub largest_subkey_class_name_length: u32, pub largest_value_name_length: u32, pub largest_value_data_size: u32, pub work_var: u32, pub key_name_length: u16, pub class_name_length: u16, pub key_name: Vec<u8>,
}
Expand description

Key node structure (nk).

Fields§

§signature: [u8; 2]

Signature: “nk”

§flags: u16

Flags.

§last_written: u64

Last written timestamp (FILETIME).

§access_bits: u8

Access bits (byte 0, Windows 8+).

§layered_key_flags: u8

Layered key bit fields (byte 1, Windows 10 RS1+).

§access_spare: u16

Spare bytes (bytes 2-3).

§parent: u32

Offset of parent key node.

§num_subkeys: u32

Number of subkeys.

§num_volatile_subkeys: u32

Number of volatile subkeys.

§subkeys_list_offset: u32

Offset of subkeys list.

§volatile_subkeys_list_offset: u32

Offset of volatile subkeys list (no meaning on disk).

§num_values: u32

Number of key values.

§values_list_offset: u32

Offset of key values list.

§security_offset: u32

Offset of key security item.

§class_name_offset: u32

Offset of class name.

§largest_subkey_name_length: u16

Largest subkey name length (in bytes, as UTF-16).

§virtualization_flags: u8

Virtualization control flags (4 bits).

§user_flags: u8

User flags / Wow64 flags (4 bits).

§debug: u8

Debug field.

§largest_subkey_class_name_length: u32

Largest subkey class name length.

§largest_value_name_length: u32

Largest value name length (in bytes, as UTF-16).

§largest_value_data_size: u32

Largest value data size.

§work_var: u32

WorkVar (cached index, not used since Windows XP).

§key_name_length: u16

Key name length in bytes.

§class_name_length: u16

Class name length in bytes.

§key_name: Vec<u8>

Key name (ASCII or UTF-16 depending on KEY_COMP_NAME flag).

Implementations§

Source§

impl KeyNode

Source

pub const FIXED_SIZE: usize = 76

Size of the fixed part of the key node (excluding name).

Source

pub fn parse(data: &[u8]) -> Result<Self>

Parse a key node from a byte slice.

Source

pub fn write<W: Write>(&self, writer: &mut W) -> Result<()>

Write the key node to a writer.

Source

pub fn name(&self) -> String

Get the key name as a string.

Source

pub fn set_name(&mut self, name: &str)

Set the key name.

Source

pub fn get_flags(&self) -> KeyNodeFlags

Get the flags.

Source

pub fn is_root(&self) -> bool

Check if this is the root key.

Check if this is a symlink.

Source

pub fn has_subkeys(&self) -> bool

Check if this key has subkeys.

Source

pub fn has_values(&self) -> bool

Check if this key has values.

Source

pub fn get_access_bits(&self) -> AccessBits

Get the access bits.

Source

pub fn get_layered_key_flags(&self) -> LayeredKeyFlags

Get the layered key flags (Windows 10 RS1+).

Source

pub fn is_tombstone(&self) -> bool

Check if this is a tombstone key (layered keys feature).

Source

pub fn get_debug_flags(&self) -> DebugFlags

Get the debug flags. These control breakpoints in checked Windows kernels when CmpRegDebugBreakEnabled is set.

Source

pub fn get_user_flags(&self) -> UserFlags

Get the user flags (Wow64 flags).

Source

pub fn get_virtualization_flags(&self) -> VirtualizationFlags

Get the virtualization control flags.

Source

pub fn has_class_name(&self) -> bool

Check if this key has a class name.

Source

pub fn is_predef_handle(&self) -> bool

Check if this key is a predefined handle. When true, the num_values field contains a handle instead of a value count.

Source

pub fn get_predef_handle(&self) -> Option<u32>

Get the predefined handle value (if this is a predefined handle key). Returns None if KEY_PREDEF_HANDLE flag is not set.

Source

pub fn new(name: &str, parent_offset: u32, is_root: bool) -> Self

Create a new key node.

Source

pub fn total_size(&self) -> usize

Get the total size needed for this key node.

Source

pub fn to_bytes(&self) -> Vec<u8>

Serialize to bytes.

Trait Implementations§

Source§

impl Clone for KeyNode

Source§

fn clone(&self) -> KeyNode

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 KeyNode

Source§

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

Formats the value using the given formatter. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.