summaryrefslogtreecommitdiff
path: root/functionrecognizer.cpp
blob: 6aa89098f7119fdb957df0750b513ddcff9ff792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}