diff options
| author | Brian Potchik <brian@vector35.com> | 2026-04-17 12:10:07 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2026-04-17 12:10:07 -0400 |
| commit | bfd306437f34ebc4d4170c5fb8170261585f6038 (patch) | |
| tree | 36dd320d130fa23239213dd94546abb9a5ab4114 /binaryninjaapi.h | |
| parent | 424dc721f5f2a3a7ffd5a6ccbcc7320b5ae7496d (diff) | |
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.
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index fa0a4716..57f896dd 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -22342,6 +22342,19 @@ namespace BinaryNinja { virtual std::optional<DerivedString> RecognizeImport( const HighLevelILInstruction& instr, Type* type, int64_t val); + /*! Can be overridden to recognize strings for constant data expressions (HLIL_CONST_DATA). + These expressions are generated by the outline resolver when it recovers constant data + streams from scattered stores. The instruction provides access to the data buffer and + builtin type via its \c constant_data accessor. + + If a string is found, return a \c DerivedString with the string information. + + \param instr High level expression containing the constant data + \return Optional \c DerivedString for any string that is found + */ + virtual std::optional<DerivedString> RecognizeConstantData( + const HighLevelILInstruction& instr); + /*! Registers the string recognizer. \param recognizer The string recognizer to register. @@ -22361,6 +22374,8 @@ namespace BinaryNinja { int64_t val, uint64_t offset, BNDerivedString* result); static bool RecognizeImportCallback( void* ctxt, BNHighLevelILFunction* hlil, size_t expr, BNType* type, int64_t val, BNDerivedString* result); + static bool RecognizeConstantDataCallback( + void* ctxt, BNHighLevelILFunction* hlil, size_t expr, BNDerivedString* result); }; class CoreStringRecognizer : public StringRecognizer @@ -22376,6 +22391,8 @@ namespace BinaryNinja { const HighLevelILInstruction& instr, Type* type, int64_t val, uint64_t offset) override; std::optional<DerivedString> RecognizeImport( const HighLevelILInstruction& instr, Type* type, int64_t val) override; + std::optional<DerivedString> RecognizeConstantData( + const HighLevelILInstruction& instr) override; }; } // namespace BinaryNinja |
