Advertisement
Guest User

Read Write Memory tutorial

a guest
Dec 13th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. while (TRUE)
  2.     {
  3.         if (GetAsyncKeyState(VK_NUMPAD1)) // HEALTH
  4.         {      
  5.             int newHealth = 1666;
  6.             WriteProcessMemory(hProcess, (BYTE*)healthAddr, &newHealth, sizeof(newHealth), nullptr);
  7.             ReadProcessMemory(hProcess, (BYTE*)healthAddr, &HealthValue, sizeof(HealthValue), nullptr);
  8.             std::cout << "New Health = " << std::dec << HealthValue << std::endl;
  9.             Sleep(1000);
  10.         }
  11.         //---------------------------------------
  12.         if (GetAsyncKeyState(VK_NUMPAD2)) // AMMO
  13.         {
  14.             int newAmmo = 1666;
  15.             WriteProcessMemory(hProcess, (BYTE*)AmmoAddr, &newAmmo, sizeof(newAmmo), nullptr);
  16.             ReadProcessMemory(hProcess, (BYTE*)AmmoAddr, &AmmoValue, sizeof(AmmoValue), nullptr);
  17.             std::cout << "New Ammo = " << std::dec << AmmoValue << std::endl;
  18.             Sleep(1000);
  19.         }
  20.         //---------------------------------------
  21.         if (GetAsyncKeyState(VK_NUMPAD3)) // PISTOL AMMO
  22.         {
  23.             int newPistolAmmo = 1666;
  24.             WriteProcessMemory(hProcess, (BYTE*)PistolAmmoAddr, &newPistolAmmo, sizeof(newPistolAmmo), nullptr);
  25.             ReadProcessMemory(hProcess, (BYTE*)PistolAmmoAddr, &PistolAmmoValue, sizeof(PistolAmmoValue), nullptr);
  26.             std::cout << "New Pistol Ammo = " << std::dec << PistolAmmoValue << std::endl;
  27.             Sleep(1000);
  28.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement