mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-04-01 04:35:34 +08:00
* Updated for memflow 0.2.2 * Replaced periods with underscores in generated file names for easier inclusion * Program execution now continues if analysis fails at any point * Removed custom error type in favor of anyhow * Added logging to cs2-dumper.log * Now compilable on Linux
25 lines
541 B
Rust
25 lines
541 B
Rust
use memflow::prelude::v1::*;
|
|
|
|
pub trait PointerExt {
|
|
fn is_null(&self) -> bool;
|
|
}
|
|
|
|
impl<U: PrimitiveAddress, T> PointerExt for Pointer<U, T> {
|
|
#[inline]
|
|
fn is_null(&self) -> bool {
|
|
self.inner.is_null()
|
|
}
|
|
}
|
|
|
|
pub fn read_addr64_rip(
|
|
process: &mut IntoProcessInstanceArcBox<'_>,
|
|
addr: Address,
|
|
) -> PartialResult<Address> {
|
|
let displacement = match process.read::<i32>(addr + 0x3) {
|
|
Ok(d) => d,
|
|
Err(e) => return Err(PartialError::Error(e.into())),
|
|
};
|
|
|
|
Ok(addr + 0x7 + displacement)
|
|
}
|