From 1f776b8b1e119d5b9eda0d51ae43b790375e7b91 Mon Sep 17 00:00:00 2001 From: mmaekr Date: Tue, 25 Apr 2023 23:19:23 -0400 Subject: added un/define_user_data_var functions --- rust/src/binaryview.rs | 12 ++++++++++++ rust/src/types.rs | 9 +++++++++ 2 files changed, 21 insertions(+) (limited to 'rust/src') diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs index 05f0d06a..3f50c001 100644 --- a/rust/src/binaryview.rs +++ b/rust/src/binaryview.rs @@ -476,6 +476,18 @@ pub trait BinaryViewExt: BinaryViewBase { } } + fn define_user_data_var(&self, dv: DataVariable) { + unsafe { + BNDefineUserDataVariable(self.as_ref().handle, dv.address, &mut dv.t.into()); + } + } + + fn undefine_user_data_var(&self, addr: u64) { + unsafe { + BNUndefineUserDataVariable(self.as_ref().handle, addr); + } + } + fn define_user_type(&self, name: S, type_obj: &Type) { unsafe { let mut qualified_name = QualifiedName::from(name); diff --git a/rust/src/types.rs b/rust/src/types.rs index 0e793cc2..c899b474 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -253,6 +253,15 @@ impl From for Conf { } } +impl From>> for BNTypeWithConfidence { + fn from(conf: Conf>) -> Self { + Self { + type_: conf.contents.handle, + confidence: conf.confidence, + } + } +} + impl From> for BNTypeWithConfidence { fn from(conf: Conf<&Type>) -> Self { Self { -- cgit v1.3.1