Equivalent to [`load`] but with a progress callback. NOTE: The progress callback will _only_ be called when loading BNDBs.
(
file_path: impl AsRef<Path>,
mut progress: P,
)
| 125 | /// |
| 126 | /// NOTE: The progress callback will _only_ be called when loading BNDBs. |
| 127 | pub fn load_with_progress<P: ProgressCallback>( |
| 128 | file_path: impl AsRef<Path>, |
| 129 | mut progress: P, |
| 130 | ) -> Option<Ref<BinaryView>> { |
| 131 | let file_path = file_path.as_ref().into_bytes_with_nul(); |
| 132 | let options = c""; |
| 133 | let handle = unsafe { |
| 134 | BNLoadFilename( |
| 135 | file_path.as_ptr() as *mut _, |
| 136 | true, |
| 137 | options.as_ptr() as *mut c_char, |
| 138 | Some(P::cb_progress_callback), |
| 139 | &mut progress as *mut P as *mut c_void, |
| 140 | ) |
| 141 | }; |
| 142 | |
| 143 | if handle.is_null() { |
| 144 | None |
| 145 | } else { |
| 146 | Some(unsafe { BinaryView::ref_from_raw(handle) }) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /// 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()`] |
| 151 | /// |
no test coverage detected