kiwidog

BF3 Player Iteration External

Feb 5th, 2013
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.81 KB | None | 0 0
  1. #pragma once
  2. #include <Windows.h>
  3. #include <iostream>
  4.  
  5. #include "structs.h"
  6. #include "offsets.h"
  7.  
  8. int main()
  9. {
  10.     DWORD pid;
  11.     HWND hWnd = FindWindowA(NULL, "Battlefield 3™");
  12.     if (!hWnd)
  13.     {
  14.         printf("Error: Could not find Window\n");
  15.         return -1;
  16.     }
  17.     GetWindowThreadProcessId(hWnd, &pid);
  18.     HANDLE pHandle = OpenProcess(PROCESS_VM_READ, false, pid);
  19.     if (!pHandle)
  20.     {
  21.         printf("Error: Could not open the process\n");
  22.         return -2;
  23.     }
  24.  
  25.     DWORD dwOut;
  26.  
  27.     DWORD fbOffset = NULL;
  28.     DWORD clientOffset = NULL;
  29.     DWORD playerManagerOffset = NULL;
  30.     DWORD idToPlayerMapOffset = NULL;
  31.     BOOL hkResult = ReadProcessMemory(pHandle, (void*)0x022B8710, &fbOffset, 4, &dwOut);
  32.     if (!hkResult)
  33.         printf("GetLastError: %i\n", GetLastError());
  34.     printf("%X dwOut: %X\n", fbOffset, dwOut);
  35.  
  36.     hkResult = ReadProcessMemory(pHandle, (void*)(fbOffset + 0xB4), &clientOffset, 4, &dwOut);
  37.  
  38.     hkResult = ReadProcessMemory(pHandle, (void*)(clientOffset + 0x1C), &playerManagerOffset, 4, &dwOut);
  39.  
  40.     hkResult = ReadProcessMemory(pHandle, (void*)(playerManagerOffset + 0xC0), &idToPlayerMapOffset, 4, &dwOut);
  41.  
  42.     for (int i = 0; i < 64; i++)
  43.     {
  44.         DWORD mPlayer;
  45.         hkResult = ReadProcessMemory(pHandle, (void*)(idToPlayerMapOffset + (i * 4)), &mPlayer, 4, &dwOut);
  46.  
  47.         if (mPlayer)
  48.         {      
  49.             DWORD mSoldier_0;
  50.             hkResult = ReadProcessMemory(pHandle, (void*)(mPlayer + 0x3C0), &mSoldier_0, 4, &dwOut);
  51.             if (mSoldier_0)
  52.             {
  53.                 DWORD mSoldier_1;
  54.                 hkResult = ReadProcessMemory(pHandle, (void*)(mSoldier_0), &mSoldier_1, 4, &dwOut);
  55.                 if (mSoldier_1)
  56.                 {
  57.                     fb::LinearTransform mTransform;
  58.                     hkResult = ReadProcessMemory(pHandle, (void*)(mSoldier_1 + 0x2AC), &mTransform, sizeof(fb::LinearTransform), &dwOut);
  59.                     DWORD dx = 0;
  60.                 }
  61.                
  62.             }
  63.             printf("Legit Player Found\n");
  64.         }
  65.     }
  66.     system("PAUSE");
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment