Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uintptr_t get_base_address()
- {
- thread_local static bool initialized = false;
- thread_local static uintptr_t base_address = 0x0;
- int x = 0;
- if (initialized)
- {
- return base_address;
- }
- else
- {
- #ifdef _WIN32
- base_address = reinterpret_cast<uintptr_t>(GetModuleHandleA(0)) - 0x0000000140000000;
- #else
- // Linux implementation
- #endif
- initialized = true;
- return base_address;
- }
- }
- inline uintptr_t get_addr(const uintptr_t address)
- {
- return (get_base_address() + address) & 0xFFFFFFFFFFFFFFFF;
- }
- struct string
- {
- string(const char *const s) : m_string(s) {}
- const char *m_string = nullptr;
- };
- bool cmd_execute(const string &command, int queue)
- {
- using T = decltype(&cmd_execute);
- uintptr_t test = get_addr(0x00000001401C6730);
- char buffer[33];
- itoa(test, buffer, 64);
- log_line(buffer);
- return reinterpret_cast<T>(get_addr(0x00000001401C6730))(command, queue);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement