summaryrefslogtreecommitdiff
path: root/functionrecognizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'functionrecognizer.cpp')
-rw-r--r--functionrecognizer.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/functionrecognizer.cpp b/functionrecognizer.cpp
new file mode 100644
index 00000000..6aa89098
--- /dev/null
+++ b/functionrecognizer.cpp
@@ -0,0 +1,33 @@
+#include "binaryninjaapi.h"
+
+using namespace BinaryNinja;
+
+
+FunctionRecognizer::FunctionRecognizer()
+{
+}
+
+
+bool FunctionRecognizer::RecognizeLowLevelILCallback(void* ctxt, BNBinaryView* data, BNFunction* func, BNLowLevelILFunction* il)
+{
+ FunctionRecognizer* recog = (FunctionRecognizer*)ctxt;
+ Ref<BinaryView> dataObj = new BinaryView(BNNewViewReference(data));
+ Ref<Function> funcObj = new Function(BNNewFunctionReference(func));
+ Ref<LowLevelILFunction> ilObj = new LowLevelILFunction(BNNewLowLevelILFunctionReference(il));
+ return recog->RecognizeLowLevelIL(dataObj, funcObj, ilObj);
+}
+
+
+void FunctionRecognizer::RegisterGlobalRecognizer(FunctionRecognizer* recog)
+{
+ BNFunctionRecognizer reg;
+ reg.context = recog;
+ reg.recognizeLowLevelIL = RecognizeLowLevelILCallback;
+ BNRegisterGlobalFunctionRecognizer(&reg);
+}
+
+
+bool FunctionRecognizer::RecognizeLowLevelIL(BinaryView*, Function*, LowLevelILFunction*)
+{
+ return false;
+}