-
Notifications
You must be signed in to change notification settings - Fork 1
/
modules.h
56 lines (43 loc) · 1.38 KB
/
modules.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
#ifndef MODULES_H
#define MODULES_H
#include <string>
#include <unordered_map>
#include <vector>
#include <list>
#include <functional>
namespace modules {
struct resource_directory;
struct resource_entry {
resource_directory* dir = nullptr;
void* data = nullptr;
size_t size;
};
struct resource_directory {
std::unordered_map<std::u16string, resource_entry> named;
std::unordered_map<size_t, resource_entry> id;
};
struct module_info {
std::string full_path;
std::string name;
std::string name_no_ext;
std::string lcase_name_no_ext;
void* base = nullptr;
void* entry = nullptr;
std::unordered_map<std::string, size_t> export_names;
std::vector<void*> exports;
size_t ordinal_base = 0;
resource_directory* root_resource_directory = nullptr;
std::list<resource_directory> all_resource_directories;
bool thread_library_calls_enabled = false;
};
module_info* get_module_info(const char* name);
module_info* get_module_info(void* base);
module_info* load_library(const char* path, bool is_load_time, bool fake_if_necessary, bool path_is_native = false);
extern std::function<void()> pre_entry_callback;
module_info* load_main(const char* path, bool overwrite = false);
module_info* load_fake_main(const char* path, std::function<void()> entry);
module_info* load_fake_module(const char* name);
void call_thread_attach();
void call_thread_detach();
};
#endif