From 23db866371f59ee7b62f1a933c415ddf8a536287 Mon Sep 17 00:00:00 2001 From: s1341 Date: Wed, 15 Jan 2025 09:57:21 +0200 Subject: [PATCH] Module: add find_global_export_by_name --- frida-gum/src/module.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frida-gum/src/module.rs b/frida-gum/src/module.rs index 418b4ba..f6f309e 100644 --- a/frida-gum/src/module.rs +++ b/frida-gum/src/module.rs @@ -150,6 +150,23 @@ impl Module { } } + /// The absolute address of the export. In the event that no such export + /// could be found, returns NULL. + pub fn find_global_export_by_name(symbol_name: &str) -> Option { + let symbol_name = CString::new(symbol_name).unwrap(); + + let ptr = unsafe { + gum_sys::gum_module_find_global_export_by_name(symbol_name.as_ptr().cast()) + as *mut c_void + }; + + if ptr.is_null() { + None + } else { + Some(NativePointer(ptr)) + } + } + /// The absolute address of the symbol. In the event that no such symbol /// could be found, returns NULL. pub fn find_symbol_by_name(&self, symbol_name: &str) -> Option {