-
Notifications
You must be signed in to change notification settings - Fork 4
/
internal.h
75 lines (62 loc) · 1.43 KB
/
internal.h
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
#pragma once
#include "PEModule.h"
#include <cstring>
/////////////////////////////////////////////////////////////////////////////
namespace cr2
{
struct ModuleImpl
{
std::string binary;
ModuleImpl()
{
}
virtual ~ModuleImpl()
{
}
private:
ModuleImpl(const ModuleImpl&);
ModuleImpl& operator=(const ModuleImpl&);
};
struct IMAGE_DATA_DIRECTORY_DX : IMAGE_DATA_DIRECTORY
{
uint64_t AVA;
};
struct IMAGE_SECTION_HEADER_DX : IMAGE_SECTION_HEADER
{
uint64_t AVA;
};
struct PEModuleImpl : public ModuleImpl
{
std::string image;
IMAGE_DOS_HEADER *dos;
IMAGE_FILE_HEADER *file;
union
{
IMAGE_NT_HEADERS *nt;
IMAGE_NT_HEADERS32 *nt32;
IMAGE_NT_HEADERS64 *nt64;
};
IMAGE_OPTIONAL_HEADER32 *optional32;
IMAGE_OPTIONAL_HEADER64 *optional64;
IMAGE_SECTION_HEADER_DX *section_headers;
IMAGE_DATA_DIRECTORY_DX data_directories[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
NameMap func_names;
std::vector<uint64_t> additional_func_avas;
uint64_t syscall_ava = 0;
std::vector<std::string> syscall_func_names;
PEModuleImpl()
: dos(NULL)
, file(NULL)
, nt(NULL)
, optional32(NULL)
, optional64(NULL)
, section_headers(NULL)
{
std::memset(data_directories, 0, sizeof(data_directories));
}
virtual ~PEModuleImpl()
{
delete[] section_headers;
}
};
} // namespace cr2