summaryrefslogtreecommitdiff
path: root/plugins/warp/src/plugin/ffi/function.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2026-03-13 12:24:18 -0700
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-03-24 18:46:48 -0700
commit3c88b11e5df33116580ac008e36092775df66135 (patch)
treecd64fbe149f05683ddabcccd0db7b87356f1f8cf /plugins/warp/src/plugin/ffi/function.rs
parentf325aa7b6026a1daef84931baeb1f50d7da10c10 (diff)
[WARP] Improved UX and API
- Exposes WARP type objects directly - Adds processor API (for generating warp files directly) - Adds file and chunk API - Misc cleanup - Simplified the amount of commands - Replaced the "Create" commands with a purpose built processor dialog - Added a native QT viewer for WARP files - Simplified committing to a remote with a purpose built commit dialog
Diffstat (limited to 'plugins/warp/src/plugin/ffi/function.rs')
-rw-r--r--plugins/warp/src/plugin/ffi/function.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/plugins/warp/src/plugin/ffi/function.rs b/plugins/warp/src/plugin/ffi/function.rs
index 138c0a7b..2eff9e4a 100644
--- a/plugins/warp/src/plugin/ffi/function.rs
+++ b/plugins/warp/src/plugin/ffi/function.rs
@@ -1,11 +1,11 @@
use crate::build_function;
use crate::cache::{insert_cached_function_match, try_cached_function_match};
-use crate::convert::{to_bn_symbol_at_address, to_bn_type};
-use crate::plugin::ffi::{BNWARPConstraint, BNWARPFunction, BNWARPFunctionGUID};
+use crate::convert::to_bn_symbol_at_address;
+use crate::plugin::ffi::{BNWARPConstraint, BNWARPFunction, BNWARPFunctionGUID, BNWARPType};
use binaryninja::function::Function;
use binaryninja::rc::Ref;
use binaryninja::string::BnString;
-use binaryninjacore_sys::{BNFunction, BNSymbol, BNType};
+use binaryninjacore_sys::{BNFunction, BNSymbol};
use std::ffi::c_char;
use std::mem::ManuallyDrop;
use std::sync::Arc;
@@ -111,19 +111,14 @@ pub unsafe extern "C" fn BNWARPFunctionGetSymbolName(function: *mut BNWARPFuncti
}
#[no_mangle]
-pub unsafe extern "C" fn BNWARPFunctionGetType(
- function: *mut BNWARPFunction,
- analysis_function: *mut BNFunction,
-) -> *mut BNType {
- let analysis_function = Function::from_raw(analysis_function);
+pub unsafe extern "C" fn BNWARPFunctionGetType(function: *mut BNWARPFunction) -> *mut BNWARPType {
// We do not own function so we should not drop.
let function = ManuallyDrop::new(Arc::from_raw(function));
match &function.ty {
Some(func_ty) => {
- let arch = analysis_function.arch();
- let function_type = to_bn_type(Some(arch), func_ty);
- // NOTE: The type ref has been pre-incremented for the caller.
- unsafe { Ref::into_raw(function_type) }.handle
+ let arc_func_ty = Arc::new(func_ty.clone());
+ // NOTE: Freed by BNWARPFreeTypeReference
+ Arc::into_raw(arc_func_ty) as *mut BNWARPType
}
None => std::ptr::null_mut(),
}