From 87b4842547cf74d5ad9d6f6a563475d471dcf94b Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Mon, 16 Oct 2023 22:35:11 -0400 Subject: [PATCH] Fix assemblies_pointer vs assemblies --- src/game_engine/unity/mono.rs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/game_engine/unity/mono.rs b/src/game_engine/unity/mono.rs index 1f53b75..094c6a3 100644 --- a/src/game_engine/unity/mono.rs +++ b/src/game_engine/unity/mono.rs @@ -126,7 +126,7 @@ impl Module { let sig_function_array: Signature<0x100> = Signature::Simple(function_array); let mono_assembly_foreach_address = sig_function_array.scan_process_range(process, module_range)?; - let assemblies: Address = match is_64_bit { + let assemblies_pointer: Address = match is_64_bit { true => { const SIG_MONO_64_DYLIB: Signature<3> = Signature::new("48 8B 3D"); // RIP-relative addressing @@ -140,12 +140,21 @@ impl Module { } }; - Some(Self { - is_64_bit, - version, - offsets, - assemblies, - }) + let assemblies: Address = match is_64_bit { + true => process.read::(assemblies_pointer).ok()?.into(), + false => process.read::(assemblies_pointer).ok()?.into(), + }; + + if assemblies.is_null() { + None + } else { + Some(Self { + is_64_bit, + version, + offsets, + assemblies, + }) + } } fn assemblies<'a>(&'a self, process: &'a Process) -> impl Iterator + 'a {