diff --git a/rust/src/function.rs b/rust/src/function.rs index 89d76bb1b..4824113eb 100644 --- a/rust/src/function.rs +++ b/rust/src/function.rs @@ -17,7 +17,7 @@ use binaryninjacore_sys::*; use crate::rc::*; use crate::string::*; use crate::tags::{Tag, TagType}; -use crate::types::{QualifiedName, QualifiedNameAndType, Variable}; +use crate::types::{QualifiedName, Variable}; use crate::{ architecture::CoreArchitecture, basicblock::{BasicBlock, BlockContext}, @@ -494,16 +494,16 @@ impl Function { /// ```no_run /// # use binaryninja::function::Function; /// # let fun: Function = todo!(); - /// fun.add_user_code_ref(0x1337, "A", None); + /// fun.add_user_type_ref(0x1337, &"A".into(), None); /// ``` pub fn add_user_type_ref( &self, from_addr: u64, - name: &QualifiedNameAndType, + name: &QualifiedName, arch: Option, ) { let arch = arch.unwrap_or_else(|| self.arch()); - let name_ptr = &name.0 as *const _ as *mut _; + let name_ptr = &name.0 as *const BNQualifiedName as *mut _; unsafe { BNAddUserTypeReference(self.handle, arch.0, from_addr, name_ptr) } } @@ -519,16 +519,16 @@ impl Function { /// ```no_run /// # use binaryninja::function::Function; /// # let fun: Function = todo!(); - /// fun.remove_user_type_ref(0x1337, "A", None); + /// fun.remove_user_type_ref(0x1337, &"A".into(), None); /// ``` pub fn remove_user_type_ref( &self, from_addr: u64, - name: &QualifiedNameAndType, + name: &QualifiedName, arch: Option, ) { let arch = arch.unwrap_or_else(|| self.arch()); - let name_ptr = &name.0 as *const _ as *mut _; + let name_ptr = &name.0 as *const BNQualifiedName as *mut _; unsafe { BNRemoveUserTypeReference(self.handle, arch.0, from_addr, name_ptr) } } diff --git a/rust/src/mlil/function.rs b/rust/src/mlil/function.rs index 435aff1e9..608d2507f 100644 --- a/rust/src/mlil/function.rs +++ b/rust/src/mlil/function.rs @@ -156,12 +156,13 @@ impl MediumLevelILFunction { /// /// # Example /// ```no_run - /// # use binaryninja::function::Function; - /// # let fun: Function = todo!(); - /// mlil_var = current_mlil[0].operands[0] - /// def_address = 0x40108d - /// var_value = PossibleValueSet.constant(5) - /// current_function.set_user_var_value(mlil_var, def_address, var_value) + /// # use binaryninja::mlil::MediumLevelILFunction; + /// # use binaryninja::types::PossibleValueSet; + /// # let mlil_fun: MediumLevelILFunction = todo!(); + /// let (mlil_var, arch_addr, _val) = mlil_fun.user_var_values().all().next().unwrap(); + /// let def_address = arch_addr.address; + /// let var_value = PossibleValueSet::ConstantValue{value: 5}; + /// mlil_fun.set_user_var_value(&mlil_var, def_address, var_value).unwrap(); /// ``` pub fn set_user_var_value( &self,