diff options
| author | Mark Rowe <mark@vector35.com> | 2026-04-13 13:07:09 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2026-04-22 15:20:52 -0700 |
| commit | aa8dab21d44b4e0dd863f0867c7e735cfb878a4d (patch) | |
| tree | 256ca89364716afed1735521106130571b0fdb9b /rust | |
| parent | 84d66dc7e6244e6ef78ebb3a2aa24b57a6ed4345 (diff) | |
Always show the triage view when opening a shared cache or kernel cache
BinaryViewType gains a HasNoInitialContent function that views can use
to suppress layout restoration when opening a file. The layout will
still be restored when the view is loaded from a saved database.
Fixes https://github.com/Vector35/binaryninja-api/issues/8083.
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/custom_binary_view.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/rust/src/custom_binary_view.rs b/rust/src/custom_binary_view.rs index 8c880fc1..84f39171 100644 --- a/rust/src/custom_binary_view.rs +++ b/rust/src/custom_binary_view.rs @@ -75,6 +75,16 @@ where }) } + extern "C" fn cb_has_no_initial_content<T>(ctxt: *mut c_void) -> bool + where + T: CustomBinaryViewType, + { + ffi_wrap!("BinaryViewTypeBase::has_no_initial_content", unsafe { + let view_type = &*(ctxt as *mut T); + view_type.has_no_initial_content() + }) + } + extern "C" fn cb_create<T>(ctxt: *mut c_void, data: *mut BNBinaryView) -> *mut BNBinaryView where T: CustomBinaryViewType, @@ -159,6 +169,7 @@ where isDeprecated: Some(cb_deprecated::<T>), isForceLoadable: Some(cb_force_loadable::<T>), getLoadSettingsForData: Some(cb_load_settings::<T>), + hasNoInitialContent: Some(cb_has_no_initial_content::<T>), }; unsafe { @@ -199,6 +210,17 @@ pub trait BinaryViewTypeBase: AsRef<BinaryViewType> { false } + /// Do instances of this [`BinaryViewType`] start with no loaded content? + /// + /// When true, the view has no meaningful default state: the user must make a + /// selection (e.g. load images from a shared cache) before any content exists. + /// Callers can use this to suppress restoring previously-saved view state for + /// files not being loaded from a database, since a saved layout would reference + /// content that isn't available on reopen. + fn has_no_initial_content(&self) -> bool { + false + } + fn default_load_settings_for_data(&self, data: &BinaryView) -> Option<Ref<Settings>> { let settings_handle = unsafe { BNGetBinaryViewDefaultLoadSettingsForData(self.as_ref().handle, data.handle) }; @@ -386,6 +408,10 @@ impl BinaryViewTypeBase for BinaryViewType { unsafe { BNIsBinaryViewTypeForceLoadable(self.handle) } } + fn has_no_initial_content(&self) -> bool { + unsafe { BNBinaryViewTypeHasNoInitialContent(self.handle) } + } + fn load_settings_for_data(&self, data: &BinaryView) -> Option<Ref<Settings>> { let settings_handle = unsafe { BNGetBinaryViewLoadSettingsForData(self.handle, data.handle) }; |
