forked from Vector35/binaryninja-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
activity.cpp
42 lines (31 loc) · 884 Bytes
/
activity.cpp
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
34
35
36
37
38
39
40
41
42
#include "binaryninjaapi.h"
#include <string>
using namespace BinaryNinja;
using namespace std;
Activity::Activity(const string& name, const std::function<void(Ref<AnalysisContext> analysisContext)>& action) :
m_action(action)
{
// LogError("API-Side Activity Constructed!");
m_object = BNCreateActivity(name.c_str(), this, Run);
}
Activity::Activity(BNActivity* activity)
{
m_object = BNNewActivityReference(activity);
}
Activity::~Activity()
{
// LogError("API-Side Activity Destructed!");
}
void Activity::Run(void* ctxt, BNAnalysisContext* analysisContext)
{
Activity* activity = (Activity*)ctxt;
Ref<AnalysisContext> ac = new AnalysisContext(BNNewAnalysisContextReference(analysisContext));
activity->m_action(ac);
}
string Activity::GetName() const
{
char* name = BNActivityGetName(m_object);
string result = name;
BNFreeString(name);
return result;
}