summaryrefslogtreecommitdiff
path: root/rust/src/platform.rs
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2026-05-22 15:44:53 -0400
committerBrandon Miller <brandon@vector35.com>2026-05-27 08:36:26 -0400
commit8fbf9ca9c0c32c600008dc6d85cacf84276736f8 (patch)
treedfac45c21a5ce7902cfedc96ecf4effdf4808832 /rust/src/platform.rs
parent8bb4ab351a7a0f371ca758ed82ca50085e6c50fd (diff)
Rust APIs for custom function lifters
Diffstat (limited to 'rust/src/platform.rs')
-rw-r--r--rust/src/platform.rs20
1 files changed, 18 insertions, 2 deletions
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<T: Into<QualifiedName>>(
+ &self,
+ name: T,
+ exact_match: bool,
+ ) -> Option<Ref<Type>> {
+ 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)