diff options
Diffstat (limited to 'rust/src/binary_view.rs')
| -rw-r--r-- | rust/src/binary_view.rs | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs index 8eb822f7..5d8f22cf 100644 --- a/rust/src/binary_view.rs +++ b/rust/src/binary_view.rs @@ -34,7 +34,7 @@ use crate::external_library::{ExternalLibrary, ExternalLocation}; use crate::file_accessor::{Accessor, FileAccessor}; use crate::file_metadata::FileMetadata; use crate::flowgraph::FlowGraph; -use crate::function::{Function, FunctionViewType, NativeBlock}; +use crate::function::{ArchAndAddr, Function, FunctionViewType, NativeBlock}; use crate::linear_view::{LinearDisassemblyLine, LinearViewCursor}; use crate::metadata::Metadata; use crate::platform::Platform; @@ -528,6 +528,10 @@ pub trait BinaryViewExt: BinaryViewBase { unsafe { BNAbortAnalysis(self.as_ref().handle) } } + fn analysis_is_aborted(&self) -> bool { + unsafe { BNAnalysisIsAborted(self.as_ref().handle) } + } + fn workflow(&self) -> Ref<Workflow> { unsafe { let raw_ptr = BNGetWorkflowForBinaryView(self.as_ref().handle); @@ -1380,6 +1384,33 @@ pub trait BinaryViewExt: BinaryViewBase { } } + fn should_skip_target_analysis( + &self, + source: &ArchAndAddr, + srcfunc: &Function, + srcend: u64, + target: &ArchAndAddr, + ) -> bool { + let mut srccopy = BNArchitectureAndAddress { + arch: source.arch.handle, + address: source.addr, + }; + let mut targetcopy = BNArchitectureAndAddress { + arch: target.arch.handle, + address: target.addr, + }; + + unsafe { + BNShouldSkipTargetAnalysis( + self.as_ref().handle, + &mut srccopy, + srcfunc.handle, + srcend, + &mut targetcopy, + ) + } + } + fn read_buffer(&self, offset: u64, len: usize) -> Result<DataBuffer> { let read_buffer = unsafe { BNReadViewBuffer(self.as_ref().handle, offset, len) }; if read_buffer.is_null() { @@ -2149,6 +2180,17 @@ pub trait BinaryViewExt: BinaryViewBase { } } + fn string_at(&self, addr: u64) -> Option<BNStringReference> { + let mut str_ref = BNStringReference::default(); + let success = unsafe { BNGetStringAtAddress(self.as_ref().handle, addr, &mut str_ref) }; + + if success { + Some(str_ref) + } else { + None + } + } + /// Retrieve all known strings within the provided `range`. /// /// NOTE: This returns a list of [`StringReference`] as strings may not be representable |
