From ba6d08199b0067adf3222559363a819f4b11c502 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Wed, 18 Jun 2025 00:14:48 -0400 Subject: Add PluginCommand for projects and hide non-contextual commands in linear/graph view --- binaryninjaapi.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 5b435cf8..bab743d3 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -14757,6 +14757,7 @@ namespace BinaryNinja { Ref lowLevelILFunction; Ref mediumLevelILFunction; Ref highLevelILFunction; + Ref project; PluginCommandContext(); }; @@ -14833,6 +14834,12 @@ namespace BinaryNinja { std::function isValid; }; + struct RegisteredProjectCommand + { + std::function action; + std::function isValid; + }; + static void DefaultPluginCommandActionCallback(void* ctxt, BNBinaryView* view); static void AddressPluginCommandActionCallback(void* ctxt, BNBinaryView* view, uint64_t addr); static void RangePluginCommandActionCallback(void* ctxt, BNBinaryView* view, uint64_t addr, uint64_t len); @@ -14849,6 +14856,7 @@ namespace BinaryNinja { void* ctxt, BNBinaryView* view, BNHighLevelILFunction* func); static void HighLevelILInstructionPluginCommandActionCallback( void* ctxt, BNBinaryView* view, BNHighLevelILFunction* func, size_t instr); + static void ProjectPluginCommandActionCallback(void* ctxt, BNProject* project); static bool DefaultPluginCommandIsValidCallback(void* ctxt, BNBinaryView* view); static bool AddressPluginCommandIsValidCallback(void* ctxt, BNBinaryView* view, uint64_t addr); @@ -14866,6 +14874,7 @@ namespace BinaryNinja { void* ctxt, BNBinaryView* view, BNHighLevelILFunction* func); static bool HighLevelILInstructionPluginCommandIsValidCallback( void* ctxt, BNBinaryView* view, BNHighLevelILFunction* func, size_t instr); + static bool ProjectPluginCommandIsValidCallback(void* ctxt, BNProject* project); public: PluginCommand(const BNPluginCommand& cmd); @@ -15692,6 +15701,13 @@ namespace BinaryNinja { const std::function& action, const std::function& isValid); + static void RegisterForProject(const std::string& name, const std::string& description, + const std::function& action); + + static void RegisterForProject(const std::string& name, const std::string& description, + const std::function& action, + const std::function& isValid); + /*! Get the list of registered PluginCommands \return The list of registered PluginCommands -- cgit v1.3.1