diff options
| author | Rubens Brandao <git@rubens.io> | 2024-05-27 17:53:57 -0300 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2024-05-28 17:11:23 -0400 |
| commit | fce26815b400b5d3c0b67a46085ba8c9a61c1457 (patch) | |
| tree | c2828f1147586ca1f5b5235aad27c700d138226b /rust/src/lib.rs | |
| parent | 53eed1fedbef8c778ba1ea03d6660a7f097886ca (diff) | |
update `Session::load_with_option` to the new API
Diffstat (limited to 'rust/src/lib.rs')
| -rw-r--r-- | rust/src/lib.rs | 11 |
1 files changed, 5 insertions, 6 deletions
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<S: BnStrCompatible>(filename: S) -> Option<rc::Ref<binaryview::BinaryView>> { 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<S: BnStrCompatible>(filename: S) -> Option<rc::Ref<binaryview::Binar /// The main way to open and load files (with options) into Binary Ninja. Make sure you've properly initialized the core before calling this function. See [`crate::headless::init()`] /// +/// <div class="warning">Your 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.</div> +/// /// ```no_run /// use binaryninja::{metadata::Metadata, rc::Ref}; /// use std::collections::HashMap; /// -/// let settings: Ref<Metadata> = 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<S: BnStrCompatible, O: IntoJson>( |
