diff options
Diffstat (limited to 'rust/src/relocation.rs')
| -rw-r--r-- | rust/src/relocation.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/rust/src/relocation.rs b/rust/src/relocation.rs index cb7e4e3d..7be7861d 100644 --- a/rust/src/relocation.rs +++ b/rust/src/relocation.rs @@ -3,7 +3,7 @@ use crate::{ architecture::{Architecture, CoreArchitecture}, binaryview::BinaryView, llil, - rc::{Ref, RefCountable}, + rc::{CoreArrayProvider, CoreArrayWrapper, CoreOwnedArrayProvider, Ref, RefCountable}, symbol::Symbol, }; use binaryninjacore_sys::*; @@ -210,6 +210,24 @@ impl Relocation { } } +impl CoreArrayProvider for Relocation { + type Raw = *mut BNRelocation; + type Context = (); +} + +unsafe impl CoreOwnedArrayProvider for Relocation { + unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { + BNFreeRelocationList(raw, count); + } +} + +unsafe impl<'a> CoreArrayWrapper<'a> for Relocation { + type Wrapped = Relocation; + unsafe fn wrap_raw(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped { + Relocation(*raw) + } +} + pub trait RelocationHandler: 'static + Sized + AsRef<CoreRelocationHandler> { type Handle: Borrow<Self>; |
