blob: ef3bfadc16b4f9e1713aa399c775e56dd0d28eaf (
plain) (
blame)
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
|
#pragma once
class syscalls {
std::unordered_map<std::string, std::pair<uint16_t, uint16_t>> m_indexes;
std::vector<char> m_stub;
void* m_call_table;
public:
syscalls();
~syscalls();
void init();
bool valid(const uintptr_t func, const size_t& size);
uint16_t get_index(const uintptr_t va, uint16_t& offset);
size_t func_size(const uint8_t* func);
template<class T>
T get(const std::string_view func) {
return reinterpret_cast<T>(uintptr_t(m_call_table) + (m_indexes[func.data()].first * m_stub.size()));
};
uintptr_t operator()(const std::string_view func) {
return uintptr_t(m_call_table) + (m_indexes[func.data()].first * m_stub.size());
}
uintptr_t operator()() {
return uintptr_t(m_call_table);
}
};
extern syscalls g_syscalls;
|