initial push

This commit is contained in:
2022-09-29 12:31:39 +02:00
commit 88a0261880
17 changed files with 1350 additions and 0 deletions

View 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__);

View 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

View 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