Trait memflow::os::process::Process

source ·
pub trait Process: Send {
Show 25 methods // Required methods fn state(&mut self) -> ProcessState; fn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<()>; fn module_address_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: ModuleAddressCallback<'_> ) -> Result<()>; fn module_by_address( &mut self, address: Address, architecture: ArchitectureIdent ) -> Result<ModuleInfo>; fn primary_module_address(&mut self) -> Result<Address>; fn module_import_list_callback( &mut self, info: &ModuleInfo, callback: ImportCallback<'_> ) -> Result<()>; fn module_export_list_callback( &mut self, info: &ModuleInfo, callback: ExportCallback<'_> ) -> Result<()>; fn module_section_list_callback( &mut self, info: &ModuleInfo, callback: SectionCallback<'_> ) -> Result<()>; fn info(&self) -> &ProcessInfo; fn mapped_mem_range( &mut self, gap_size: imem, start: Address, end: Address, out: MemoryRangeCallback<'_> ); // Provided methods fn module_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: ModuleInfoCallback<'_> ) -> Result<()> { ... } fn module_by_name_arch( &mut self, name: &str, architecture: Option<&ArchitectureIdent> ) -> Result<ModuleInfo> { ... } fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo> { ... } fn module_list_arch( &mut self, target_arch: Option<&ArchitectureIdent> ) -> Result<Vec<ModuleInfo>> { ... } fn module_list(&mut self) -> Result<Vec<ModuleInfo>> { ... } fn primary_module(&mut self) -> Result<ModuleInfo> { ... } fn module_import_list( &mut self, info: &ModuleInfo ) -> Result<Vec<ImportInfo>> { ... } fn module_export_list( &mut self, info: &ModuleInfo ) -> Result<Vec<ExportInfo>> { ... } fn module_section_list( &mut self, info: &ModuleInfo ) -> Result<Vec<SectionInfo>> { ... } fn module_import_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<ImportInfo> { ... } fn module_export_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<ExportInfo> { ... } fn module_section_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<SectionInfo> { ... } fn mapped_mem_range_vec( &mut self, gap_size: imem, start: Address, end: Address ) -> Vec<MemoryRange> { ... } fn mapped_mem(&mut self, gap_size: imem, out: MemoryRangeCallback<'_>) { ... } fn mapped_mem_vec(&mut self, gap_size: imem) -> Vec<MemoryRange> { ... }
}
Expand description

Provides all actions on processes

This trait provides a lot of typical functionality for processes, such as memory access, module lists, and basic information.

Future expansions could include threads, keyboard input, and more.

Required Methods§

source

fn state(&mut self) -> ProcessState

Retrieves the state of the process

source

fn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<()>

Changes the dtb this process uses for memory translations

Remarks

In case the architecture only uses a single dtb for translation the second parameter should be set to Address::invalid().

source

fn module_address_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: ModuleAddressCallback<'_> ) -> Result<()>

Walks the process’ module list and calls the provided callback for each module structure address

Arguments
  • target_arch - sets which architecture to retrieve the modules for (if emulated). Choose between Some(ProcessInfo::sys_arch()), and Some(ProcessInfo::proc_arch()). None for all.
  • callback - where to pass each matching module to. This is an opaque callback.
source

fn module_by_address( &mut self, address: Address, architecture: ArchitectureIdent ) -> Result<ModuleInfo>

Retrieves a module by its structure address and architecture

Arguments
  • address - address where module’s information resides in
  • architecture - architecture of the module. Should be either ProcessInfo::proc_arch, or ProcessInfo::sys_arch.
source

fn primary_module_address(&mut self) -> Result<Address>

Retrieves address of the primary module structure of the process

This will generally be for the initial executable that was run

source

fn module_import_list_callback( &mut self, info: &ModuleInfo, callback: ImportCallback<'_> ) -> Result<()>

Retrieves a list of all imports of a given module

source

fn module_export_list_callback( &mut self, info: &ModuleInfo, callback: ExportCallback<'_> ) -> Result<()>

Retrieves a list of all exports of a given module

source

fn module_section_list_callback( &mut self, info: &ModuleInfo, callback: SectionCallback<'_> ) -> Result<()>

Retrieves a list of all sections of a given module

source

fn info(&self) -> &ProcessInfo

Retrieves the process info

source

fn mapped_mem_range( &mut self, gap_size: imem, start: Address, end: Address, out: MemoryRangeCallback<'_> )

Provided Methods§

source

fn module_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: ModuleInfoCallback<'_> ) -> Result<()>

Walks the process’ module list and calls the provided callback for each module

Arguments
  • target_arch - sets which architecture to retrieve the modules for (if emulated). Choose between Some(ProcessInfo::sys_arch()), and Some(ProcessInfo::proc_arch()). None for all.
  • callback - where to pass each matching module to. This is an opaque callback.
source

fn module_by_name_arch( &mut self, name: &str, architecture: Option<&ArchitectureIdent> ) -> Result<ModuleInfo>

Finds a process module by its name under specified architecture

This function can be useful for quickly accessing a specific module

Arguments
  • name - name of the module to find
  • architecture - architecture of the module. Should be either ProcessInfo::proc_arch, or ProcessInfo::sys_arch, or None for both.
source

fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo>

Finds any architecture process module by its name

This function can be useful for quickly accessing a specific module

Arguments
  • name - name of the module to find
source

fn module_list_arch( &mut self, target_arch: Option<&ArchitectureIdent> ) -> Result<Vec<ModuleInfo>>

Retrieves a module list for the process

Arguments
  • target_arch - sets which architecture to retrieve the modules for (if emulated). Choose between Some(ProcessInfo::sys_arch()), and Some(ProcessInfo::proc_arch()). None for all.
source

fn module_list(&mut self) -> Result<Vec<ModuleInfo>>

Retrieves a module list for the process

This is equivalent to Process::module_list_arch(None)

source

fn primary_module(&mut self) -> Result<ModuleInfo>

Retrieves information for the primary module of the process

This will generally be the initial executable that was run

source

fn module_import_list(&mut self, info: &ModuleInfo) -> Result<Vec<ImportInfo>>

Retrieves a list of all imports of a given module

source

fn module_export_list(&mut self, info: &ModuleInfo) -> Result<Vec<ExportInfo>>

Retrieves a list of all exports of a given module

source

fn module_section_list(&mut self, info: &ModuleInfo) -> Result<Vec<SectionInfo>>

Retrieves a list of all sections of a given module

source

fn module_import_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<ImportInfo>

Finds a single import of a given module by its name

source

fn module_export_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<ExportInfo>

Finds a single export of a given module by its name

source

fn module_section_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<SectionInfo>

Finds a single section of a given module by its name

source

fn mapped_mem_range_vec( &mut self, gap_size: imem, start: Address, end: Address ) -> Vec<MemoryRange>

source

fn mapped_mem(&mut self, gap_size: imem, out: MemoryRangeCallback<'_>)

source

fn mapped_mem_vec(&mut self, gap_size: imem) -> Vec<MemoryRange>

Implementors§

source§

impl<'cglue_a, CGlueO: 'cglue_a + GetContainer + GetVtbl<ProcessVtbl<'cglue_a, <Self as GetContainer>::ContType>> + Send + ProcessOpaqueObj<'cglue_a>> Process for CGlueO
where ProcessVtbl<'cglue_a, <Self as GetContainer>::ContType>: StableAbi,