Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "proc.h"
- int main()
- {
- //Get ProcID of the game eg: AC_Client;
- DWORD procId = GetProcID(L"ac_client.exe");
- //Get Module base address
- uintptr_t modBase = GetModBaseAddress(procId, L"ac_client.exe");
- //Get handle process
- HANDLE hProc = 0;
- hProc = OpenProcess(PROCESS_ALL_ACCESS, NULL, procId);
- //Resolve base address of the pointer chain
- uintptr_t dynamicPtrAddress = modBase + 0x50F4F4;
- std::cout << "Dynamic Ptr = " << std::dec << dynamicPtrAddress << std::endl;
- //Ammo value
- int ammoValue = 0;
- //DWORD primaryAmmoAddress = 0x0281A4E0;
- std::vector<unsigned int>ammoOffset = { 0x374, 0x14, 0x0 };
- uintptr_t ammoAddr = FindDMAAddy(hProc, dynamicPtrAddress, ammoOffset);
- //Read the primary ammo address
- ReadProcessMemory(hProc, (BYTE*)ammoAddr, &ammoValue, sizeof(ammoValue), nullptr);
- std::cout << "Current Ammo = " << std::dec << ammoValue << std::endl;
- //Write to the new address
- int newAmmoValue = 9999;
- WriteProcessMemory(hProc, (BYTE*)ammoAddr, &newAmmoValue, sizeof(newAmmoValue), nullptr);
- //Read the modified address
- ReadProcessMemory(hProc, (BYTE*)ammoAddr, &ammoValue, sizeof(ammoValue), nullptr);
- std::cout << "New Ammo = " << std::dec << ammoValue << std::endl;
- int healthValue = 0;
- std::vector<unsigned int>healthOffset = { 0xF8 };
- uintptr_t healthAddr = FindDMAAddy(hProc, dynamicPtrAddress, healthOffset);
- std::cout << "Health address = " << std::hex << healthAddr << std::endl;
- ReadProcessMemory(hProc, (BYTE*)healthAddr, &healthValue, sizeof(healthValue), nullptr);
- std::cout << "Current Health = " << std::dec << healthValue << std::endl;
- //Write to our health address the new value which in this case will be LEET
- int newHealthValue = 1337;
- WriteProcessMemory(hProc, (BYTE*)healthAddr, &newHealthValue, sizeof(newHealthValue), nullptr);
- //Then read it again
- ReadProcessMemory(hProc, (BYTE*)healthAddr, &healthValue, sizeof(healthValue), nullptr);
- std::cout << "New Health = " << std::dec << healthValue << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement