From 87ce2ef8339839dc391f07178f2aac6dc29e1a9d Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Mon, 22 May 2023 16:05:43 -0400 Subject: Add support for changing enumeration member names by clicking 'N' on their token --- binaryninjaapi.h | 2 +- binaryninjacore.h | 4 ++-- type.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index f4b1d9dc..e3231f85 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -7855,7 +7855,7 @@ namespace BinaryNinja { public: Enumeration(BNEnumeration* e); - std::vector GetTokensForValue(uint64_t value, size_t width); + std::vector GetTokensForValue(uint64_t value, size_t width, Ref type); std::vector GetMembers() const; }; diff --git a/binaryninjacore.h b/binaryninjacore.h index 67454a43..4b4f43cc 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -36,7 +36,7 @@ // Current ABI version for linking to the core. This is incremented any time // there are changes to the API that affect linking, including new functions, // new types, or modifications to existing functions or types. -#define BN_CURRENT_CORE_ABI_VERSION 34 +#define BN_CURRENT_CORE_ABI_VERSION 35 // Minimum ABI version that is supported for loading of plugins. Plugins that // are linked to an ABI version less than this will not be able to load and @@ -5559,7 +5559,7 @@ extern "C" BINARYNINJACOREAPI BNEnumerationMember* BNGetEnumerationMembers(BNEnumeration* e, size_t* count); BINARYNINJACOREAPI BNInstructionTextToken* BNGetEnumerationTokensForValue(BNEnumeration* e, uint64_t value, - uint64_t width, size_t* count); + uint64_t width, size_t* count, BNType* type); BINARYNINJACOREAPI void BNFreeEnumerationMemberList(BNEnumerationMember* members, size_t count); BINARYNINJACOREAPI BNEnumerationMember* BNGetEnumerationBuilderMembers(BNEnumerationBuilder* e, size_t* count); diff --git a/type.cpp b/type.cpp index 12973b2a..50766dc8 100644 --- a/type.cpp +++ b/type.cpp @@ -2559,10 +2559,10 @@ vector Enumeration::GetMembers() const } -vector Enumeration::GetTokensForValue(uint64_t value, size_t width) +vector Enumeration::GetTokensForValue(uint64_t value, size_t width, Ref type) { size_t count; - BNInstructionTextToken* tokens = BNGetEnumerationTokensForValue(m_object, value, width, &count); + BNInstructionTextToken* tokens = BNGetEnumerationTokensForValue(m_object, value, width, &count, type->GetObject()); return InstructionTextToken::ConvertAndFreeInstructionTextTokenList(tokens, count); } -- cgit v1.3.1