-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathModule.hpp
More file actions
81 lines (63 loc) · 1.54 KB
/
Module.hpp
File metadata and controls
81 lines (63 loc) · 1.54 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
#pragma once
#include "Region.hpp"
#include "Handle.hpp"
#include <string>
#include <vector>
#include <fcntl.h>
#include <unistd.h>
#include <elf.h>
#include <string.h>
namespace remote {
struct ModuleSymbol
{
ModuleSymbol() {
offset = 0;
}
off_t offset;
std::string name;
};
class Module
{
public:
typedef enum {
ARCH_32,
ARCH_64
} eArch;
Module() {
regions.clear();
}
Module(std::vector<remote::Region> regs) {
regions = regs;
}
bool IsValid() {
return (GetRegionCount() > 0);
}
std::string GetPath() {
return (*regions.begin()).pathname;
}
std::string GetFileName() {
return (*regions.begin()).filename;
}
size_t GetStart() {
return regions.begin()->start;
}
size_t GetEnd() {
return regions.end()->end;
}
size_t GetRegionCount() {
return regions.size();
}
Region GetRegionByIndex(size_t index) {
return regions.at(index);
}
void CacheSymbolData();
size_t GetSymbolAddress(std::string name);
private:
void CacheSymbolData32(void* buffer);
void CacheSymbolData64(void* buffer);
//
std::vector<remote::Region> regions;
std::vector<remote::ModuleSymbol> symbols;
};
Module GetModuleHandle(remote::Handle proc, std::string filename);
};