diff options
| author | Brian Potchik <brian@vector35.com> | 2025-03-17 13:12:18 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2025-03-17 13:12:18 -0400 |
| commit | eeb1402948a3bc9ef66635f42229ab165b163285 (patch) | |
| tree | 52385ca71e236b2989e665f345aed593f7943223 | |
| parent | 1652efdc43aa3acbd570c1f042a35da458538bb4 (diff) | |
Add search mode detection feedback in find dialog for advanced binary search.
| -rw-r--r-- | binaryninjaapi.h | 2 | ||||
| -rw-r--r-- | binaryninjacore.h | 3 | ||||
| -rw-r--r-- | binaryview.cpp | 9 |
3 files changed, 13 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 15b62e25..2e4ec080 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -6490,6 +6490,8 @@ namespace BinaryNinja { const FunctionViewType& viewType, const std::function<bool(size_t current, size_t total)>& progress, const std::function<bool(uint64_t addr, const LinearDisassemblyLine& line)>& matchCallback); + std::string DetectSearchMode(const std::string& query); + bool Search(const std::string& query, const std::function<bool(size_t current, size_t total)>& progressCallback, const std::function<bool(uint64_t addr, const DataBuffer& buffer)>& matchCallback); diff --git a/binaryninjacore.h b/binaryninjacore.h index 8dbda6fe..bc014d36 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -37,7 +37,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 100 +#define BN_CURRENT_CORE_ABI_VERSION 101 // 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 @@ -4224,6 +4224,7 @@ extern "C" bool (*matchCallback)(void* matchCtxt, uint64_t addr, BNLinearDisassemblyLine* line)); BINARYNINJACOREAPI bool BNSearch(BNBinaryView* view, const char* query, void* context, BNProgressFunction progressCallback, void* matchContext, bool (*callback)(void*, uint64_t, BNDataBuffer*)); + BINARYNINJACOREAPI char* BNDetectSearchMode(const char* query); BINARYNINJACOREAPI bool BNPerformSearch(const char* query, const uint8_t* buffer, size_t size, bool(*callback)(void*, size_t, size_t), void* context); BINARYNINJACOREAPI void BNBeginBulkAddSegments(BNBinaryView* view); diff --git a/binaryview.cpp b/binaryview.cpp index 981e8329..f37057e3 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -4795,6 +4795,15 @@ bool BinaryView::FindAllConstant(uint64_t start, uint64_t end, uint64_t constant } +string BinaryView::DetectSearchMode(const string& query) +{ + char* searchMode = BNDetectSearchMode(query.c_str()); + string result = searchMode; + BNFreeString(searchMode); + return result; +} + + bool BinaryView::Search(const string& query, const std::function<bool(size_t current, size_t total)>& progressCallback, const std::function<bool(uint64_t offset, const DataBuffer& buffer)>& matchCallback) { ProgressContext fp; |
