pub trait ProcessTraitswhere
Self: Sized,{
Show 34 methods
// Required methods
fn initialize(
proc_name: &str,
exclude: &[&str],
) -> Result<Self, ProcessError>;
fn find_process(
proc_name: &str,
exclude: &[&str],
) -> Result<Self, ProcessError>;
fn read_regions(self) -> Result<Self, ProcessError>;
fn read_signature<T: TryFrom<usize>>(
&self,
sign: &Signature,
) -> Result<T, ProcessError>;
fn read<T: TryInto<usize>>(
&self,
addr: T,
len: usize,
buff: &mut [u8],
) -> Result<(), ProcessError>;
// Provided methods
fn read_uleb128<T: TryInto<usize>>(
&self,
addr: T,
) -> Result<u64, ProcessError> { ... }
fn read_string_with_limit_from_ptr<T: TryInto<usize>>(
&self,
addr: T,
limit: usize,
) -> Result<String, ProcessError> { ... }
fn read_string_with_limit<T: TryInto<usize>>(
&self,
addr: T,
limit: usize,
) -> Result<String, ProcessError> { ... }
fn read_string_from_ptr<T: TryInto<usize>>(
&self,
addr: T,
) -> Result<String, ProcessError> { ... }
fn read_string<T: TryInto<usize>>(
&self,
addr: T,
) -> Result<String, ProcessError> { ... }
fn read_i8<T: TryInto<usize>>(&self, addr: T) -> Result<i8, ProcessError> { ... }
fn read_i16<T: TryInto<usize>>(&self, addr: T) -> Result<i16, ProcessError> { ... }
fn read_i32<T: TryInto<usize>>(&self, addr: T) -> Result<i32, ProcessError> { ... }
fn read_i64<T: TryInto<usize>>(&self, addr: T) -> Result<i64, ProcessError> { ... }
fn read_i128<T: TryInto<usize>>(
&self,
addr: T,
) -> Result<i128, ProcessError> { ... }
fn read_u8<T: TryInto<usize>>(&self, addr: T) -> Result<u8, ProcessError> { ... }
fn read_u16<T: TryInto<usize>>(&self, addr: T) -> Result<u16, ProcessError> { ... }
fn read_u32<T: TryInto<usize>>(&self, addr: T) -> Result<u32, ProcessError> { ... }
fn read_u64<T: TryInto<usize>>(&self, addr: T) -> Result<u64, ProcessError> { ... }
fn read_u128<T: TryInto<usize>>(
&self,
addr: T,
) -> Result<u128, ProcessError> { ... }
fn read_f32<T: TryInto<usize>>(&self, addr: T) -> Result<f32, ProcessError> { ... }
fn read_f64<T: TryInto<usize>>(&self, addr: T) -> Result<f64, ProcessError> { ... }
fn read_i8_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<i8>,
) -> Result<(), ProcessError> { ... }
fn read_i16_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<i16>,
) -> Result<(), ProcessError> { ... }
fn read_i32_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<i32>,
) -> Result<(), ProcessError> { ... }
fn read_i64_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<i64>,
) -> Result<(), ProcessError> { ... }
fn read_i128_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<i128>,
) -> Result<(), ProcessError> { ... }
fn read_u8_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<u8>,
) -> Result<(), ProcessError> { ... }
fn read_u16_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<u16>,
) -> Result<(), ProcessError> { ... }
fn read_u32_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<u32>,
) -> Result<(), ProcessError> { ... }
fn read_u64_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<u64>,
) -> Result<(), ProcessError> { ... }
fn read_u128_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<u128>,
) -> Result<(), ProcessError> { ... }
fn read_f32_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<f32>,
) -> Result<(), ProcessError> { ... }
fn read_f64_array<T: TryInto<usize>>(
&self,
addr: T,
buff: &mut Vec<f64>,
) -> Result<(), ProcessError> { ... }
}Required Methods§
Sourcefn initialize(proc_name: &str, exclude: &[&str]) -> Result<Self, ProcessError>
fn initialize(proc_name: &str, exclude: &[&str]) -> Result<Self, ProcessError>
Initialize a Process struct
proc_name- Name of the process or key wordsexclude- Key words to avoid when searching for process name
Notes:
For more details of searching the process name see [find_process]
method
Sourcefn find_process(proc_name: &str, exclude: &[&str]) -> Result<Self, ProcessError>
fn find_process(proc_name: &str, exclude: &[&str]) -> Result<Self, ProcessError>
Attemp to find a process
proc_name- Name of the process or key wordsexclude- Keywords to avoid when searching for process name
§Notes
It’s going try to search process name by using str::contains function
with proc_name argument on process name. Same applies to exclude
Sourcefn read_regions(self) -> Result<Self, ProcessError>
fn read_regions(self) -> Result<Self, ProcessError>
Collect memory regions offsets into itself.
Notes:
- Function isn’t whole memory just their offsets.
Check out
MemoryRegionfor more info
fn read_signature<T: TryFrom<usize>>( &self, sign: &Signature, ) -> Result<T, ProcessError>
fn read<T: TryInto<usize>>( &self, addr: T, len: usize, buff: &mut [u8], ) -> Result<(), ProcessError>
Provided Methods§
fn read_uleb128<T: TryInto<usize>>(&self, addr: T) -> Result<u64, ProcessError>
Sourcefn read_string_with_limit_from_ptr<T: TryInto<usize>>(
&self,
addr: T,
limit: usize,
) -> Result<String, ProcessError>
fn read_string_with_limit_from_ptr<T: TryInto<usize>>( &self, addr: T, limit: usize, ) -> Result<String, ProcessError>
Same behaviour as ProcessTraits::read_string_from_ptr()
The only diffrence is that function will throw
a ProcessError::StringTooLarge error if readed string length
is over a provided limit
Notes:
*_from_ptr()functions usually will result in additional heap allocation, due to generic behaviour. If you need to avoid heap allocations at all costs, read pointer manually and then pass address to theProcessTraits::read_string()function
Sourcefn read_string_with_limit<T: TryInto<usize>>(
&self,
addr: T,
limit: usize,
) -> Result<String, ProcessError>
fn read_string_with_limit<T: TryInto<usize>>( &self, addr: T, limit: usize, ) -> Result<String, ProcessError>
Reads a C# string. For more info checkout ProcessTraits::read_string()
The only diffrence is that function will throw
a ProcessError::StringTooLarge error if readed string length
is over a provided limit
Sourcefn read_string_from_ptr<T: TryInto<usize>>(
&self,
addr: T,
) -> Result<String, ProcessError>
fn read_string_from_ptr<T: TryInto<usize>>( &self, addr: T, ) -> Result<String, ProcessError>
Reads a C# string based on C# string structure
Assumes passed addr is a pointer, so it’s gonna make
additional pointer read.
Notes:
*_from_ptr()functions usually will result in additional heap allocation, due to generic behaviour. If you need to avoid heap allocations at all costs, read pointer manually and then pass address to theProcessTraits::read_string()function
Sourcefn read_string<T: TryInto<usize>>(
&self,
addr: T,
) -> Result<String, ProcessError>
fn read_string<T: TryInto<usize>>( &self, addr: T, ) -> Result<String, ProcessError>
Reads a C# string based on C# string structure
Assumes passed addr is not a pointer, so no additional
pointer reads is gonna be made.
If you have a pointer to string either read that pointer youself
or use ProcessTraits::read_string_from_ptr()
fn read_i8<T: TryInto<usize>>(&self, addr: T) -> Result<i8, ProcessError>
fn read_i16<T: TryInto<usize>>(&self, addr: T) -> Result<i16, ProcessError>
fn read_i32<T: TryInto<usize>>(&self, addr: T) -> Result<i32, ProcessError>
fn read_i64<T: TryInto<usize>>(&self, addr: T) -> Result<i64, ProcessError>
fn read_i128<T: TryInto<usize>>(&self, addr: T) -> Result<i128, ProcessError>
fn read_u8<T: TryInto<usize>>(&self, addr: T) -> Result<u8, ProcessError>
fn read_u16<T: TryInto<usize>>(&self, addr: T) -> Result<u16, ProcessError>
fn read_u32<T: TryInto<usize>>(&self, addr: T) -> Result<u32, ProcessError>
fn read_u64<T: TryInto<usize>>(&self, addr: T) -> Result<u64, ProcessError>
fn read_u128<T: TryInto<usize>>(&self, addr: T) -> Result<u128, ProcessError>
fn read_f32<T: TryInto<usize>>(&self, addr: T) -> Result<f32, ProcessError>
fn read_f64<T: TryInto<usize>>(&self, addr: T) -> Result<f64, ProcessError>
fn read_i8_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<i8>, ) -> Result<(), ProcessError>
fn read_i16_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<i16>, ) -> Result<(), ProcessError>
fn read_i32_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<i32>, ) -> Result<(), ProcessError>
fn read_i64_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<i64>, ) -> Result<(), ProcessError>
fn read_i128_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<i128>, ) -> Result<(), ProcessError>
fn read_u8_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<u8>, ) -> Result<(), ProcessError>
fn read_u16_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<u16>, ) -> Result<(), ProcessError>
fn read_u32_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<u32>, ) -> Result<(), ProcessError>
fn read_u64_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<u64>, ) -> Result<(), ProcessError>
fn read_u128_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<u128>, ) -> Result<(), ProcessError>
fn read_f32_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<f32>, ) -> Result<(), ProcessError>
fn read_f64_array<T: TryInto<usize>>( &self, addr: T, buff: &mut Vec<f64>, ) -> Result<(), ProcessError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".