Skip to main content

vmi_core/os/
user_module.rs

1use super::VmiOs;
2use crate::{Va, VmiDriver, VmiError, VmiVa};
3
4/// A trait for user-mode modules.
5///
6/// This trait provides an abstraction over modules loaded into a process
7/// address space, such as executables and shared libraries.
8pub trait VmiOsUserModule<'a, Driver>: VmiVa + 'a
9where
10    Driver: VmiDriver,
11{
12    /// The VMI OS type.
13    type Os: VmiOs<Driver = Driver>;
14
15    /// Returns the base address of the module.
16    ///
17    /// # Platform-specific
18    ///
19    /// - **Windows**: `LDR_DATA_TABLE_ENTRY.DllBase`
20    fn base_address(&self) -> Result<Va, VmiError>;
21
22    /// Returns the size of the module.
23    ///
24    /// # Platform-specific
25    ///
26    /// - **Windows**: `LDR_DATA_TABLE_ENTRY.SizeOfImage`
27    fn size(&self) -> Result<u64, VmiError>;
28
29    /// Returns the name of the module.
30    ///
31    /// # Platform-specific
32    ///
33    /// - **Windows**: `LDR_DATA_TABLE_ENTRY.BaseDllName`
34    fn name(&self) -> Result<String, VmiError>;
35}