forked from nihilus/hexrays_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchoosers.cpp
More file actions
executable file
·123 lines (105 loc) · 2.72 KB
/
Copy pathchoosers.cpp
File metadata and controls
executable file
·123 lines (105 loc) · 2.72 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <hexrays.hpp>
#include <struct.hpp>
#include <bytes.hpp>
#include <kernwin.hpp>
#include <algorithm>
#include <pro.h>
#include "structures.h"
#include "choosers.h"
uint32 idaapi matched_structs_with_offsets::sizer(void *obj)
{
matched_structs_with_offsets & ms = *(matched_structs_with_offsets*)obj;
return ms.idcka.size();
}
void idaapi matched_structs_with_offsets::get_type_line(void *obj,uint32 n,char * const *arrptr)
{
matched_structs_with_offsets & ms = *(matched_structs_with_offsets*)obj;
if (n==0)
{
qstrncpy(arrptr[0], "member", MAXSTR);
qstrncpy(arrptr[1], "type", MAXSTR);
}
else
{
char name[MAXSTR];
name[0]=0;
char type_str[MAXSTR];
type_str[0]=0;
tid_t id = ms.idcka[n-1];
struc_t * struc = get_struc(id);
print_struct_member_name(struc, ms.offset, name, sizeof(name));
member_t * member = 0;
if(struct_get_member(get_struc(id), ms.offset, &member) && member)
{
//typestring type;
tinfo_t type;
if(get_member_type(member, &type))
{
type.print(new qstring(type_str));
}
}
qstpncpy(arrptr[0], name, MAXSTR);
qstpncpy(arrptr[1], type_str, MAXSTR);
}
}
uint32 idaapi matched_structs::sizer(void *obj)
{
matched_structs & ms = *(matched_structs*)obj;
return ms.idcka.size();
}
char * idaapi matched_structs::get_type_line(void *obj, uint32 n, char *buf)
{
matched_structs & ms = *(matched_structs*)obj;
if (n==0)
qstpncpy( buf, "type", MAXSTR );
else
{
qstring name;
;
tid_t id = ms.idcka[n-1];
struc_t * struc = get_struc(id);
if (struc)
get_struc_name(&name, id);
//asize_t size = get_struc_size(id);
qsnprintf(buf, MAXSTR, "%s", name.c_str());
}
return buf;
}
uint32 idaapi function_list::sizer(void *obj)
{
function_list & ms = *(function_list*)obj;
return ms.functions.size();
}
static const char *header[] =
{
"Address",
"Function name",
"Comment",
};
void idaapi function_list::get_line(void *obj,uint32 n,char * const *arrptr)
{
if ( n == 0 ) // generate the column headers
{
for ( int i=0; i < qnumber(header); i++ )
qstrncpy(arrptr[i], header[i], MAXSTR);
return;
}
function_list & ms = *(function_list*)obj;
ea_t ea = ms.functions[n-1];
qsnprintf(arrptr[0], MAXSTR, "%08a", ea);
get_func_name(ea, arrptr[1], MAXSTR);
//get_short_name(BADADDR, ea, arrptr[1], MAXSTR);
//get_demangled_name(BADADDR, ea, arrptr[1], MAXSTR, inf.long_demnames, DEMNAM_NAME, 0);
func_t * f = get_func(ea);
if(f)
{
const char * cmt = get_func_cmt(f, true);
if(cmt)
{
qstrncpy(arrptr[2], cmt, MAXSTR);
}
}
}