Skip to content

Commit

Permalink
Add parameter_variables API to Function in Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
D0ntPanic committed Apr 30, 2024
1 parent e88d386 commit 7c04b4b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion rust/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub use binaryninjacore_sys::BNAnalysisSkipReason as AnalysisSkipReason;
pub use binaryninjacore_sys::BNFunctionAnalysisSkipOverride as FunctionAnalysisSkipOverride;
pub use binaryninjacore_sys::BNFunctionUpdateType as FunctionUpdateType;


use std::hash::Hash;
use std::{fmt, mem};

Expand Down Expand Up @@ -315,6 +314,22 @@ impl Function {
}
}

pub fn parameter_variables(&self) -> Conf<Vec<Variable>> {
unsafe {
let mut variables = BNGetFunctionParameterVariables(self.handle);
let mut result = Vec::with_capacity(variables.count);
let confidence = variables.confidence;
let vars = std::slice::from_raw_parts(variables.vars, variables.count);

for i in 0..variables.count {
result.push(Variable::from_raw(vars[i]));
}

BNFreeParameterVariables(&mut variables);
Conf::new(result, confidence)
}
}

pub fn apply_imported_types(&self, sym: &Symbol, t: Option<&Type>) {
unsafe {
BNApplyImportedTypes(
Expand Down

0 comments on commit 7c04b4b

Please sign in to comment.