initial push
This commit is contained in:
31
ac_checker/include/util/hooklib.hpp
Normal file
31
ac_checker/include/util/hooklib.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
|
||||
namespace util {
|
||||
|
||||
struct Hook {
|
||||
uintptr_t _bytes = 0;
|
||||
uintptr_t _target = 0;
|
||||
uintptr_t _detour = 0;
|
||||
uintptr_t _tramp = 0;
|
||||
|
||||
bool enable(uintptr_t target, uintptr_t detour);
|
||||
void disable();
|
||||
|
||||
template <typename Target, typename Detour>
|
||||
inline bool enable(Target target, Detour detour) {
|
||||
return enable((uintptr_t) target, (uintptr_t) detour);
|
||||
}
|
||||
|
||||
template <typename Func, typename... Args>
|
||||
inline auto invoke(Args &&...args) const {
|
||||
return ((Func) _tramp)(std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
|
||||
#define define_hook(name, ret, call_conv, ...) \
|
||||
inline util::Hook name; \
|
||||
ret call_conv name##_hook(__VA_ARGS__);
|
16
ac_checker/include/util/memory.hpp
Normal file
16
ac_checker/include/util/memory.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace signatures {
|
||||
|
||||
constexpr static auto s_token_log_ref = "558BEC83EC08C645FC01C745";
|
||||
|
||||
}
|
||||
|
||||
namespace util {
|
||||
|
||||
uint8_t *find_pattern(std::string_view pattern, uint8_t *begin, size_t size, ptrdiff_t offset = 0x0);
|
||||
uint8_t *scan_module(std::string_view module_name, std::string_view pattern, ptrdiff_t offset = 0x0);
|
||||
|
||||
} // namespace util
|
17
ac_checker/include/util/pe.hpp
Normal file
17
ac_checker/include/util/pe.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
|
||||
// <3 mr polish man
|
||||
|
||||
namespace util {
|
||||
|
||||
struct ModuleInfo {
|
||||
uintptr_t base;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
ModuleInfo get_module(std::string_view module_name);
|
||||
uintptr_t get_export(std::string_view module_name, std::string_view export_name);
|
||||
|
||||
} // namespace util
|
Reference in New Issue
Block a user