From bfd306437f34ebc4d4170c5fb8170261585f6038 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Fri, 17 Apr 2026 12:10:07 -0400 Subject: Add RecognizeConstantData to StringRecognizer API Adds a new recognize_constant_data method to the StringRecognizer API, enabling plugins to decode constant data expressions (HLIL_CONST_DATA) recovered by the outline resolver. The recognizer receives the full instruction, giving access to the data buffer and builtin type via the constant_data accessor. Also fixes a pre-existing ctypes mismatch in get_constant_data_and_builtin where BNBuiltinType (uint8_t) was incorrectly passed as c_int. --- binaryninjacore.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'binaryninjacore.h') diff --git a/binaryninjacore.h b/binaryninjacore.h index 382bf1d2..a0b985ec 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -37,14 +37,14 @@ // 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 165 +#define BN_CURRENT_CORE_ABI_VERSION 166 // 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 // will require rebuilding. The minimum version is increased when there are // incompatible changes that break binary compatibility, such as changes to // existing types or functions. -#define BN_MINIMUM_CORE_ABI_VERSION 165 +#define BN_MINIMUM_CORE_ABI_VERSION 166 #ifdef __GNUC__ #ifdef BINARYNINJACORE_LIBRARY @@ -4022,6 +4022,8 @@ extern "C" uint64_t offset, BNDerivedString* result); bool (*recognizeImport)( void* ctxt, BNHighLevelILFunction* hlil, size_t expr, BNType* type, int64_t val, BNDerivedString* result); + bool (*recognizeConstantData)( + void* ctxt, BNHighLevelILFunction* hlil, size_t expr, BNDerivedString* result); } BNCustomStringRecognizer; typedef struct BNCustomStringTypeInfo @@ -9079,6 +9081,8 @@ extern "C" BNHighLevelILFunction* il, size_t exprIndex, BNType* type, int64_t val, uint64_t offset, BNDerivedString* out); BINARYNINJACOREAPI bool BNStringRecognizerRecognizeImport(BNStringRecognizer* recognizer, BNHighLevelILFunction* il, size_t exprIndex, BNType* type, int64_t val, BNDerivedString* out); + BINARYNINJACOREAPI bool BNStringRecognizerRecognizeConstantData(BNStringRecognizer* recognizer, + BNHighLevelILFunction* il, size_t exprIndex, BNDerivedString* out); // PossibleValueSet operations BINARYNINJACOREAPI void BNFreePossibleValueSet(BNPossibleValueSet* object); -- cgit v1.3.1