-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader.hpp
More file actions
48 lines (35 loc) · 852 Bytes
/
loader.hpp
File metadata and controls
48 lines (35 loc) · 852 Bytes
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
#ifndef ELF_LOADER_HPP
#define ELF_LOADER_HPP
#include <stdlib.h>
#include <stdio.h>
#include <string_view>
#include <windows.h>
#include "common.h"
#include "elf.hpp"
class ElfLoader {
public:
ElfLoader(std::string_view path) { Init(path); }
~ElfLoader();
public:
void Load();
void Show();
void Run();
private:
void Init(std::string_view path);
private:
bool ValidateCheck() { return true; } // 检查magic,判断文件类型
bool SetupLoadInfo(); // 填充地址
void LayoutSection();
void LayoutSymtab();
private:
FILE* file_{nullptr};
void* data_{nullptr};
private:
struct {
unsigned int sym, str, mod, vers, info, pcpu;
} index;
Elf64_Ehdr* hdr_;
Elf64_Shdr* shdr_;
char *secstrings_, *strtab_;
};
#endif // ELF_LOADER_HPP