Guest User

Untitled

a guest
Dec 2nd, 2024
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.05 KB | Source Code | 0 0
  1. uintptr_t offsetBase = 0x07E39430;
  2. uintptr_t offset1 = (18);
  3. uintptr_t offset2 = (448*2);
  4.  
  5. int main()
  6. {
  7.  
  8.     // Find the process ID of the target process
  9.     auto pid = findPidByName("NBA2K25.exe");
  10.     uintptr_t baseAddress = GetModuleBaseAddress(pid, L"NBA2K25.exe");
  11.  
  12.  
  13.     // If the process ID is found
  14.     if (pid)
  15.     {
  16.  
  17.         // Open the process with all access
  18.         HANDLE handleToProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
  19.  
  20.         if (handleToProcess)
  21.         {
  22.  
  23.             // -------------------------------------------- //
  24.  
  25.             uintptr_t address = 0; // Base address or pointer
  26.             if (!ReadProcessMemory(handleToProcess, (LPCVOID)(baseAddress + offsetBase), &address, sizeof(address), 0)) {
  27.                 std::cerr << "Failed to read base player address." << std::endl;
  28.                 std::cerr << "Error code: " << GetLastError() << std::endl;
  29.                 return 1;
  30.             }
  31.             std::cout << "(baseAddress + baseOffset): P->0x" << std::hex << address << std::endl;
  32.  
  33.             // -------------------------------------------- //
  34.  
  35.             uintptr_t nextAddress = (address + (offset1)); // Calculate the next
  36.             if (!ReadProcessMemory(handleToProcess, (LPCVOID)(nextAddress), &address, sizeof(address), 0)) {
  37.                 std::cerr << "Failed to read player address after offset 0x12." << std::endl;
  38.                 std::cerr << "Error code: " << GetLastError() << std::endl;
  39.                 return 1;
  40.             }
  41.             std::cout << "(address + offset1): P->0x" << std::hex << address << std::endl;
  42.  
  43.             // -------------------------------------------- //
  44.  
  45.             nextAddress = address + (offset2); // Calculate the next
  46.             if (!ReadProcessMemory(handleToProcess, (LPCVOID)(nextAddress), &address, sizeof(address), 0)) {
  47.                 std::cerr << "Failed to read player address after offset (448*0)." << std::endl;
  48.                 std::cerr << "Error code: " << GetLastError() << std::endl;
  49.                 return 1;
  50.             }
  51.             std::cout << "(address + offset2): P->0x" << std::hex << address << std::endl;
  52.  
  53.         }
  54.         else
  55.         {
  56.             std::cout << "Sync2K: Could not open process.\n";
  57.         }
  58.  
  59.     }
  60.     else
  61.     {
  62.         std::cout << "Sync2K: Could not connect./\n";
  63.     }
  64.  
  65.     std::cin.ignore();
  66.     std::cin.get();
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment