This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
pe_bound_import.h
83 lines (64 loc) · 2.75 KB
/
pe_bound_import.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
76
77
78
79
80
81
82
83
#pragma once
class pe_bound_imported_ref{
std::string ref_name;
uint32_t timestamp;
public:
pe_bound_imported_ref();
pe_bound_imported_ref(const std::string& ref_name, uint32_t timestamp);
~pe_bound_imported_ref() = default;
pe_bound_imported_ref(const pe_bound_imported_ref&) = default;
pe_bound_imported_ref& operator=(const pe_bound_imported_ref&) = default;
pe_bound_imported_ref(pe_bound_imported_ref&&) = default;
pe_bound_imported_ref& operator=(pe_bound_imported_ref&&) = default;
public:
void set_ref_name(const std::string& ref_name);
void set_timestamp(uint32_t timestamp);
public:
std::string get_ref_name() const;
uint32_t get_timestamp() const;
};
class pe_bound_library {
std::string library_name;
uint32_t timestamp;
std::vector<pe_bound_imported_ref> refs;
public:
pe_bound_library();
~pe_bound_library() = default;
pe_bound_library(const pe_bound_library&) = default;
pe_bound_library& operator=(const pe_bound_library&) = default;
pe_bound_library(pe_bound_library&&) = default;
pe_bound_library& operator=(pe_bound_library&&) = default;
public:
void set_library_name(const std::string& library_name);
void set_timestamp(uint32_t timestamp);
void add_ref(const pe_bound_imported_ref& ref);
public:
std::string get_library_name() const;
uint32_t get_timestamp() const;
size_t get_number_of_forwarder_refs() const;
const std::vector<pe_bound_imported_ref>& get_refs() const;
std::vector<pe_bound_imported_ref>& get_refs();
};
class pe_bound_import_directory {
std::vector<pe_bound_library> libraries;
public:
pe_bound_import_directory() = default;
~pe_bound_import_directory() = default;
pe_bound_import_directory(const pe_bound_import_directory&) = default;
pe_bound_import_directory& operator=(const pe_bound_import_directory&) = default;
pe_bound_import_directory(pe_bound_import_directory&&) = default;
pe_bound_import_directory& operator=(pe_bound_import_directory&&) = default;
public:
void add_library(const pe_bound_library& lib);
void clear();
public:
size_t size() const;
bool has_library(const std::string& library_name, uint32_t timestamp) const;
bool has_library(const std::string& library_name) const;
const std::vector<pe_bound_library>& get_libraries() const;
std::vector<pe_bound_library>& get_libraries();
};
pe_directory_code get_bound_import_directory(_In_ const pe_image &image, _Out_ pe_bound_import_directory& imports);
bool build_bound_import_directory(_Inout_ pe_image &image, _Inout_ pe_section& section,
_In_ pe_bound_import_directory& imports);
pe_directory_code get_placement_bound_import_directory(_In_ const pe_image &image, _Inout_ pe_placement& placement);