/
ida_wrappers.cpp
71 lines (60 loc) · 1.47 KB
/
ida_wrappers.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <kernwin.hpp>
#include <lines.hpp>
#include <funcs.hpp>
#include <stdlib.h>
/* wrapping because these shits are inline.. */
#ifdef __cplusplus
extern "C" {
#endif
ea_t wrapped_get_screen_ea(void)
{
return get_screen_ea();
}
bool wrapped_jumpto(ea_t ea)
{
return jumpto(ea, -1);
}
char *wrapped_get_curline(void)
{
char *current_line = get_curline();
tag_remove(current_line, current_line, 0);
return current_line;
}
int wrapped_msg(const char *string)
{
return msg("%s", string);
}
void wrapped_describe(ea_t effective_address, const char *string)
{
describe(effective_address, 1, "%s", string);
}
char function_comment_buffer[1024] = {0};
char *wrapped_get_func_cmt(func_t *fn, bool repeatable)
{
int length = -1;
char *original_result = get_func_cmt(fn, repeatable);
if (NULL == original_result) { return ""; }
length = strlen(original_result);
qstrncpy(function_comment_buffer, original_result, length+1);
qfree(original_result);
return function_comment_buffer;
}
bool wrapped_set_func_cmt(func_t *fn, const char *cmt, bool repeatable)
{
return set_func_cmt(fn, cmt, repeatable);
}
void wrapped_del_func_cmt(func_t *fn, bool repeatable)
{
del_func_cmt(fn, repeatable);
}
char function_name_buffer[1024] = {0};
char *wrapped_get_func_name(ea_t ea)
{
size_t bufsize = 0;
char *function_name = get_func_name(ea, function_name_buffer, sizeof(function_name_buffer)-1);
if (NULL == function_name) { return ""; }
return function_name_buffer;
}
#ifdef __cplusplus
}
#endif