Fix small naming inconsistencies

This commit is contained in:
a2x
2024-04-06 12:47:06 +10:00
parent a59331af1f
commit 6d72c517ed
6 changed files with 31 additions and 22 deletions

View File

@@ -131,7 +131,7 @@ pub struct SchemaEnumInfoData {
pub alignment: u8,
pad_0019: [u8; 0x3],
pub size: u16,
pub static_metadata_count: u16,
pub num_static_metadata: u16,
pub enum_info: Pointer64<SchemaEnumeratorInfoData>,
pub static_metadata: Pointer64<SchemaMetadataEntryData>,
pub type_scope: Pointer64<SchemaSystemTypeScope>,

View File

@@ -4,7 +4,7 @@ use memflow::prelude::v1::*;
#[derive(Pod)]
#[repr(C)]
pub struct InterfaceReg {
pub create_fn: Pointer64<()>,
pub name: Pointer64<ReprCString>,
pub next: Pointer64<InterfaceReg>,
pub create_fn: Pointer64<()>, // 0x0000
pub name: Pointer64<ReprCString>, // 0x0008
pub next: Pointer64<InterfaceReg>, // 0x0010
}

View File

@@ -17,9 +17,9 @@ unsafe impl<D: 'static> Pod for HashAllocatedBlob<D> {}
#[repr(C)]
pub struct HashBucket<D, K> {
pad_0000: [u8; 0x18], // 0x0000,
pub first: Pointer64<HashFixedData<D, K>>, // 0x0018
pub first_uncommited: Pointer64<HashFixedData<D, K>>, // 0x0020
pad_0000: [u8; 0x18], // 0x0000,
pub first: Pointer64<HashFixedData<D, K>>, // 0x0018
pub first_uncommitted: Pointer64<HashFixedData<D, K>>, // 0x0020
}
#[repr(C)]
@@ -45,21 +45,23 @@ pub struct UtlTsHash<D, const C: usize = 256, K = u64> {
impl<D: Pod + IsNull, const C: usize, K: Pod> UtlTsHash<D, C, K> {
/// Returns all elements in the hash table.
pub fn elements(&self, process: &mut IntoProcessInstanceArcBox<'_>) -> Result<Vec<D>> {
// TODO: Refactor this.
let mut elements: Vec<_> = self
.buckets
.iter()
.flat_map(|bucket| {
let mut element_ptr = bucket.first;
let mut cur_element = bucket.first;
let mut list = Vec::new();
while !element_ptr.is_null() {
if let Ok(element) = element_ptr.read(process) {
while !cur_element.is_null() {
if let Ok(element) = cur_element.read(process) {
if !element.data.is_null() {
list.push(element.data);
}
element_ptr = element.next;
cur_element = element.next;
}
}
@@ -87,8 +89,6 @@ impl<D: Pod + IsNull, const C: usize, K: Pod> UtlTsHash<D, C, K> {
}
}
// TODO: Separate allocated and unallocated data.
Ok(elements)
}
}