From fce26815b400b5d3c0b67a46085ba8c9a61c1457 Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Mon, 27 May 2024 17:53:57 -0300 Subject: update `Session::load_with_option` to the new API --- rust/src/lib.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'rust/src/lib.rs') diff --git a/rust/src/lib.rs b/rust/src/lib.rs index f20a33a9..cb511a7a 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -197,12 +197,13 @@ const BN_INVALID_EXPR: usize = usize::MAX; /// The main way to open and load files into Binary Ninja. Make sure you've properly initialized the core before calling this function. See [`crate::headless::init()`] pub fn load(filename: S) -> Option> { let filename = filename.into_bytes_with_nul(); + let options = ""; let handle = unsafe { binaryninjacore_sys::BNLoadFilename( filename.as_ref().as_ptr() as *mut _, true, - std::ptr::null(), + options.as_ptr() as *mut core::ffi::c_char, None, ) }; @@ -216,15 +217,13 @@ pub fn load(filename: S) -> OptionYour JSON needs to be compliant with RapidJSON's format, which basically means you just need to escape double quotes (\") and single quotes won't work. +/// /// ```no_run /// use binaryninja::{metadata::Metadata, rc::Ref}; /// use std::collections::HashMap; /// -/// let settings: Ref = HashMap::from([ -/// ("analysis.linearSweep.autorun", false.into()), -/// ]).into(); -/// -/// let bv = binaryninja::load_with_options("/bin/cat", true, Some(settings)) +/// let bv = binaryninja::load_with_options("/bin/cat", true, Some("{\"analysis.linearSweep.autorun\": false}")) /// .expect("Couldn't open `/bin/cat`"); /// ``` pub fn load_with_options( -- cgit v1.3.1