From ddd7aa4e7cd5a1aa07a16c3895d1f91ebf49347b Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Tue, 24 Mar 2026 09:05:49 -0700 Subject: Add a hook to allow BinaryView subclasses to run code after snapshot data is applied Snapshot data is applied when loading from a database, rebasing the view, etc. --- binaryninjaapi.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 7b46f97f..e62b1d3e 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -5773,6 +5773,15 @@ namespace BinaryNinja { void PerformDefineRelocation(Architecture* arch, BNRelocationInfo& info, uint64_t target, uint64_t reloc); void PerformDefineRelocation(Architecture* arch, BNRelocationInfo& info, Ref sym, uint64_t reloc); + /*! OnAfterSnapshotDataApplied is called when loading a view from a database, after snapshot data has been applied to it. + + \note This method **may** be overridden by custom BinaryViews. + + \warning This method **must not** be called directly. + + */ + virtual void OnAfterSnapshotDataApplied() {} + public: void NotifyDataWritten(uint64_t offset, size_t len); void NotifyDataInserted(uint64_t offset, size_t len); @@ -5780,6 +5789,7 @@ namespace BinaryNinja { private: static bool InitCallback(void* ctxt); + static void OnAfterSnapshotDataAppliedCallback(void* ctxt); static void FreeCallback(void* ctxt); static size_t ReadCallback(void* ctxt, void* dest, uint64_t offset, size_t len); static size_t WriteCallback(void* ctxt, uint64_t offset, const void* src, size_t len); -- cgit v1.3.1