summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-10-25 12:09:57 -0400
committerMason Reed <mason@vector35.com>2024-10-25 12:10:35 -0400
commit3452ee25b9aebdddf694f45b4273ab76ca1bc847 (patch)
treef080a5262f3156439d87b9f7981902975804645a /rust/src
parentf97c60b5f77c4b9b668ff0b5fd292b41521c72fd (diff)
Retrieve view from analysis context
Makes it possible to write module workflows in plugins and scripts
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/workflow.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/rust/src/workflow.rs b/rust/src/workflow.rs
index b3a17a77..8409ad70 100644
--- a/rust/src/workflow.rs
+++ b/rust/src/workflow.rs
@@ -10,6 +10,7 @@ use crate::llil::{self, FunctionForm, Mutable};
use crate::rc::{Array, CoreArrayProvider, CoreArrayProviderInner, Guard, Ref, RefCountable};
use crate::string::{BnStrCompatible, BnString};
use crate::{hlil, mlil};
+use crate::binaryview::BinaryView;
#[repr(transparent)]
/// The AnalysisContext struct is used to represent the current state of
@@ -29,6 +30,13 @@ impl AnalysisContext {
Ref::new(Self { handle })
}
+ /// BinaryView for the current AnalysisContext
+ pub fn view(&self) -> Ref<BinaryView> {
+ let result = unsafe { BNAnalysisContextGetBinaryView(self.handle.as_ptr()) };
+ assert!(!result.is_null());
+ unsafe { BinaryView::from_raw(result) }
+ }
+
/// Function for the current AnalysisContext
pub fn function(&self) -> Ref<Function> {
let result = unsafe { BNAnalysisContextGetFunction(self.handle.as_ptr()) };