pub struct Hive<B, S>where
B: BinReaderExt,
S: HiveStatus,{
pub data: MemOverlay<B>,
/* private fields */
}
Expand description
Represents a registry hive file.
Because most offsets in a registry hive file are relative to the start of the hive bins data, this struct provides a own Seek and Read implementation, which can work directly with those kinds of offsets. You don’t know where the hive bins data starts, because Hive knows it (this information is stored in the hive base block). To parse data from within the hive bins data, use Hive as reader and use offsets read from the hive data structures.
The structure of hive files is documented at https://github.com/msuhanov/regf/blob/master/Windows%20registry%20file%20format%20specification.md#format-of-primary-files
Fields§
§data: MemOverlay<B>
Implementations§
source§impl<B, S> Hive<B, S>where
B: BinReaderExt,
S: HiveStatus,
impl<B, S> Hive<B, S>where
B: BinReaderExt,
S: HiveStatus,
sourcepub fn new(data: B, parse_mode: HiveParseMode) -> BinResult<Self>
pub fn new(data: B, parse_mode: HiveParseMode) -> BinResult<Self>
creates a new Hive object. This includes parsing the HiveBaseBlock and determining the start of the hive bins data.
sourcepub fn write_baseblock<W: Write>(&self, writer: &mut W) -> Result<()>
pub fn write_baseblock<W: Write>(&self, writer: &mut W) -> Result<()>
write the baseblock to some writer
This method ignores any patches to the base block which might
be introduced by log files, because the apply_transaction_log()
method
takes care of the base block and handles all necessary changes
pub fn is_checksum_valid(&self) -> Option<bool>
source§impl<B> Hive<B, DirtyHive>where
B: BinReaderExt,
impl<B> Hive<B, DirtyHive>where
B: BinReaderExt,
pub fn treat_hive_as_clean(self) -> Hive<B, CleanHive> ⓘ
pub fn apply_transaction_log( &mut self, log: TransactionLogsEntry ) -> ApplicationResult
source§impl<B> Hive<B, CleanHive>where
B: BinReaderExt,
impl<B> Hive<B, CleanHive>where
B: BinReaderExt,
pub fn is_primary_file(&self) -> bool
sourcepub fn enum_subkeys(
&mut self,
callback: fn(_: &mut Self, _: &KeyNode) -> BinResult<()>
) -> BinResult<()>
pub fn enum_subkeys( &mut self, callback: fn(_: &mut Self, _: &KeyNode) -> BinResult<()> ) -> BinResult<()>
Is this really needed???
sourcepub fn root_key_node(&mut self) -> BinResult<KeyNode>
pub fn root_key_node(&mut self) -> BinResult<KeyNode>
returns the root key of this registry hive file
sourcepub fn read_structure<T>(&mut self, offset: Offset) -> BinResult<T>
pub fn read_structure<T>(&mut self, offset: Offset) -> BinResult<T>
sourcepub fn data_offset(&self) -> u32
pub fn data_offset(&self) -> u32
returns the start of the hive bins data
sourcepub fn root_cell_offset(&self) -> Offset
pub fn root_cell_offset(&self) -> Offset
returns the offset of the root cell
pub fn find_root_celloffset(self) -> Option<Offset>
pub fn reset_cursor(&mut self) -> Result<()>
pub fn hivebins(self) -> impl Iterator<Item = HiveBin<B>>
pub fn data_size(&self) -> u32
Trait Implementations§
source§impl<B, S> BaseBlock for Hive<B, S>where
B: BinReaderExt,
S: HiveStatus,
impl<B, S> BaseBlock for Hive<B, S>where
B: BinReaderExt,
S: HiveStatus,
fn base_block(&self) -> Option<&HiveBaseBlock>
source§impl<B> ContainsHive<B> for Hive<B, DirtyHive>where
B: BinReaderExt,
impl<B> ContainsHive<B> for Hive<B, DirtyHive>where
B: BinReaderExt,
fn with_transaction_log( self, log: TransactionLog ) -> Result<HiveWithLogs<B, Self>>
source§impl<B> Read for Hive<B, CleanHive>where
B: BinReaderExt,
impl<B> Read for Hive<B, CleanHive>where
B: BinReaderExt,
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf
. Read more1.0.0 · source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf
. Read more1.6.0 · source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf
. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read moresource§impl<B> Seek for Hive<B, CleanHive>where
B: BinReaderExt,
impl<B> Seek for Hive<B, CleanHive>where
B: BinReaderExt,
This Seek
implementation hides the base block,
because the offsets used in hive files are relative
to the end of the base block.
If you want to read the base block, don’t use seek()
and read()
,
but write_baseblock()
instead
source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
1.55.0 · source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len
)Auto Trait Implementations§
impl<B, S> Freeze for Hive<B, S>where
B: Freeze,
impl<B, S> RefUnwindSafe for Hive<B, S>where
B: RefUnwindSafe,
S: RefUnwindSafe,
impl<B, S> Send for Hive<B, S>
impl<B, S> Sync for Hive<B, S>
impl<B, S> Unpin for Hive<B, S>
impl<B, S> UnwindSafe for Hive<B, S>where
B: UnwindSafe,
S: UnwindSafe,
Blanket Implementations§
source§impl<R> BinReaderExt for R
impl<R> BinReaderExt for R
source§fn read_type<T>(&mut self, endian: Endian) -> Result<T, Error>where
T: BinRead,
fn read_type<T>(&mut self, endian: Endian) -> Result<T, Error>where
T: BinRead,
source§fn read_be<T>(&mut self) -> Result<T, Error>where
T: BinRead,
fn read_be<T>(&mut self) -> Result<T, Error>where
T: BinRead,
source§fn read_le<T>(&mut self) -> Result<T, Error>where
T: BinRead,
fn read_le<T>(&mut self) -> Result<T, Error>where
T: BinRead,
source§fn read_ne<T>(&mut self) -> Result<T, Error>where
T: BinRead,
fn read_ne<T>(&mut self) -> Result<T, Error>where
T: BinRead,
source§fn read_type_args<T>(
&mut self,
endian: Endian,
args: <T as BinRead>::Args
) -> Result<T, Error>where
T: BinRead,
fn read_type_args<T>(
&mut self,
endian: Endian,
args: <T as BinRead>::Args
) -> Result<T, Error>where
T: BinRead,
T
from the reader with the given byte order and arguments.source§fn read_be_args<T>(&mut self, args: <T as BinRead>::Args) -> Result<T, Error>where
T: BinRead,
fn read_be_args<T>(&mut self, args: <T as BinRead>::Args) -> Result<T, Error>where
T: BinRead,
T
from the reader, assuming big-endian byte order, using the
given arguments.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<R> ReadBytesExt for R
impl<R> ReadBytesExt for R
source§fn read_u8(&mut self) -> Result<u8, Error>
fn read_u8(&mut self) -> Result<u8, Error>
source§fn read_i8(&mut self) -> Result<i8, Error>
fn read_i8(&mut self) -> Result<i8, Error>
source§fn read_u16<T>(&mut self) -> Result<u16, Error>where
T: ByteOrder,
fn read_u16<T>(&mut self) -> Result<u16, Error>where
T: ByteOrder,
source§fn read_i16<T>(&mut self) -> Result<i16, Error>where
T: ByteOrder,
fn read_i16<T>(&mut self) -> Result<i16, Error>where
T: ByteOrder,
source§fn read_u24<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
fn read_u24<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
source§fn read_i24<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
fn read_i24<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
source§fn read_u32<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
fn read_u32<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
source§fn read_i32<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
fn read_i32<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
source§fn read_u48<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
fn read_u48<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
source§fn read_i48<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
fn read_i48<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
source§fn read_u64<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
fn read_u64<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
source§fn read_i64<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
fn read_i64<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
source§fn read_u128<T>(&mut self) -> Result<u128, Error>where
T: ByteOrder,
fn read_u128<T>(&mut self) -> Result<u128, Error>where
T: ByteOrder,
source§fn read_i128<T>(&mut self) -> Result<i128, Error>where
T: ByteOrder,
fn read_i128<T>(&mut self) -> Result<i128, Error>where
T: ByteOrder,
source§fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error>where
T: ByteOrder,
fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error>where
T: ByteOrder,
source§fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error>where
T: ByteOrder,
fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error>where
T: ByteOrder,
source§fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error>where
T: ByteOrder,
fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error>where
T: ByteOrder,
source§fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error>where
T: ByteOrder,
fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error>where
T: ByteOrder,
source§fn read_f32<T>(&mut self) -> Result<f32, Error>where
T: ByteOrder,
fn read_f32<T>(&mut self) -> Result<f32, Error>where
T: ByteOrder,
source§fn read_f64<T>(&mut self) -> Result<f64, Error>where
T: ByteOrder,
fn read_f64<T>(&mut self) -> Result<f64, Error>where
T: ByteOrder,
source§fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error>where
T: ByteOrder,
fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error>where
T: ByteOrder,
fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error>where
T: ByteOrder,
fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error>where
T: ByteOrder,
fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
source§fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error>where
T: ByteOrder,
fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error>where
T: ByteOrder,
fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error>where
T: ByteOrder,
fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error>where
T: ByteOrder,
fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
source§fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
read_f32_into
instead