* 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
This commit is contained in:
a2x
2024-07-30 02:06:35 +10:00
parent 8897183075
commit 7933103b03
98 changed files with 8413 additions and 8332 deletions

View File

@@ -15,8 +15,8 @@ pub struct SchemaClassInfoData {
pub name: Pointer64<ReprCString>, // 0x0008
pub module_name: Pointer64<ReprCString>, // 0x0010
pub size: i32, // 0x0018
pub fields_count: i16, // 0x001C
pub static_fields_count: i16, // 0x001E
pub field_count: i16, // 0x001C
pub static_field_count: i16, // 0x001E
pub static_metadata_count: i16, // 0x0020
pub align_of: u8, // 0x0022
pub has_base_class: u8, // 0x0023

View File

@@ -14,7 +14,7 @@ pub struct SchemaEnumInfoData {
pub size: u8, // 0x0018
pub align_of: u8, // 0x0019
pad_001a: [u8; 0x2], // 0x001A
pub enumerators_count: u16, // 0x001C
pub enumerator_count: u16, // 0x001C
pub static_metadata_count: u16, // 0x001E
pub enumerators: Pointer64<[SchemaEnumeratorInfoData]>, // 0x0020
pub static_metadata: Pointer64<SchemaMetadataEntryData>, // 0x0028

View File

@@ -1,6 +1,6 @@
use memflow::prelude::v1::*;
use anyhow::{bail, Result};
use crate::error::{Error, Result};
use memflow::prelude::v1::*;
#[repr(C)]
pub struct UtlMemory<T> {
@@ -16,11 +16,14 @@ impl<T: Pod> UtlMemory<T> {
}
pub fn element(&self, process: &mut IntoProcessInstanceArcBox<'_>, idx: usize) -> Result<T> {
if idx >= self.count() as usize {
return Err(Error::Other("index out of bounds"));
if idx >= self.count() as _ {
bail!("index out of bounds");
}
self.mem.at(idx as _).read(process).map_err(Into::into)
process
.read_ptr(self.mem.at(idx as _))
.data_part()
.map_err(Into::into)
}
#[inline]

View File

@@ -1,8 +1,9 @@
use anyhow::Result;
use memflow::prelude::v1::*;
use super::UtlMemoryPoolBase;
use crate::error::Result;
use crate::mem::PointerExt;
#[repr(C)]
@@ -70,13 +71,13 @@ where
let mut cur_element = bucket.first_uncommitted;
while !cur_element.is_null() {
let element = cur_element.read(process)?;
let element = process.read_ptr(cur_element).data_part()?;
if !element.data.is_null() {
unallocated_list.push(element.data);
allocated_list.push(element.data);
}
if unallocated_list.len() >= blocks_alloc {
if allocated_list.len() >= blocks_alloc {
break;
}
@@ -88,13 +89,13 @@ where
Pointer64::<HashAllocatedBlob<D>>::from(self.entry_mem.free_list_head.address());
while !cur_blob.is_null() {
let blob = cur_blob.read(process)?;
let blob = process.read_ptr(cur_blob).data_part()?;
if !blob.data.is_null() {
allocated_list.push(blob.data);
unallocated_list.push(blob.data);
}
if allocated_list.len() >= peak_alloc {
if unallocated_list.len() >= peak_alloc {
break;
}

View File

@@ -1,6 +1,6 @@
use memflow::prelude::v1::*;
use anyhow::{bail, Result};
use crate::error::{Error, Result};
use memflow::prelude::v1::*;
#[repr(C)]
pub struct UtlVector<T> {
@@ -17,10 +17,13 @@ impl<T: Pod> UtlVector<T> {
pub fn element(&self, process: &mut IntoProcessInstanceArcBox<'_>, idx: usize) -> Result<T> {
if idx >= self.count() as usize {
return Err(Error::Other("index out of bounds"));
bail!("index out of bounds");
}
self.mem.at(idx as _).read(process).map_err(Into::into)
process
.read_ptr(self.mem.at(idx as _))
.data_part()
.map_err(Into::into)
}
}