Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1.  
  2. uintptr_t get_base_address()
  3. {
  4.     thread_local static bool initialized = false;
  5.     thread_local static uintptr_t base_address = 0x0;
  6.     int x = 0;
  7.  
  8.  
  9.     if (initialized)
  10.     {
  11.         return base_address;
  12.     }
  13.     else
  14.     {
  15. #ifdef _WIN32
  16.         base_address = reinterpret_cast<uintptr_t>(GetModuleHandleA(0)) - 0x0000000140000000;
  17. #else
  18.         // Linux implementation
  19. #endif
  20.  
  21.         initialized = true;
  22.         return base_address;
  23.     }
  24. }
  25.  
  26. inline uintptr_t get_addr(const uintptr_t address)
  27. {
  28.     return (get_base_address() + address) & 0xFFFFFFFFFFFFFFFF;
  29. }
  30.  
  31. struct string
  32. {
  33.     string(const char *const s) : m_string(s) {}
  34.     const char *m_string = nullptr;
  35. };
  36.  
  37.  
  38. bool cmd_execute(const string &command, int queue)
  39. {
  40.     using T = decltype(&cmd_execute);
  41.  
  42.     uintptr_t test = get_addr(0x00000001401C6730);
  43.     char buffer[33];
  44.  
  45.     itoa(test, buffer, 64);
  46.     log_line(buffer);
  47.  
  48.  
  49.     return reinterpret_cast<T>(get_addr(0x00000001401C6730))(command, queue);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement