From 8fbf9ca9c0c32c600008dc6d85cacf84276736f8 Mon Sep 17 00:00:00 2001 From: Brandon Miller Date: Fri, 22 May 2026 15:44:53 -0400 Subject: Rust APIs for custom function lifters --- rust/src/platform.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'rust/src/platform.rs') diff --git a/rust/src/platform.rs b/rust/src/platform.rs index e70e1277..9de125a1 100644 --- a/rust/src/platform.rs +++ b/rust/src/platform.rs @@ -20,8 +20,8 @@ use crate::{ rc::*, string::*, types::{ - QualifiedNameAndType, TypeContainer, TypeLibrary, TypeParserError, TypeParserErrorSeverity, - TypeParserResult, + QualifiedName, QualifiedNameAndType, Type, TypeContainer, TypeLibrary, TypeParserError, + TypeParserErrorSeverity, TypeParserResult, }, }; use binaryninjacore_sys::*; @@ -279,6 +279,22 @@ impl Platform { } } + pub fn function_by_name>( + &self, + name: T, + exact_match: bool, + ) -> Option> { + let mut raw_name = QualifiedName::into_raw(name.into()); + unsafe { + let type_handle = BNGetPlatformFunctionByName(self.handle, &mut raw_name, exact_match); + QualifiedName::free_raw(raw_name); + if type_handle.is_null() { + return None; + } + Some(Type::ref_from_raw(type_handle)) + } + } + // TODO: system_calls // TODO: add a helper function to define a system call (platform function with a specific type) -- cgit v1.3.1