
// My first game hack. This is for "Sniper: Ghost Warrior"
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
int main ()
{
HWND hWnd = FindWindow(0, L"Sniper: Ghost Warrior"); // Finds the window titled "Sniper: Ghost Warrior".
if (hWnd == 0) // If it can't find the window, then:
{
cout << "Can't find window, dopey noonga!" << endl;
}
else
{
DWORD pr0c3zz;
GetWindowThreadProcessId(hWnd, &pr0c3zz); // Locates the process through the window.
HANDLE trollpr0c3zz = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pr0c3zz); // Gives access to process.
if (!trollpr0c3zz) // If it can't access the process, then:
{
cout << "I can nawtz open pr0c3zz :(." << endl;
}
else
{
int ammoAmount = 10; // Amount of bullets in current round.
int roundsAmount = 60; // Amount of rounds left.
int ammoAddr = 0x29500340; // Ammunition memory address.
int roundsAddr = 0x296E629C; // Rounds memory address.
cout << "Unlimited ammo - F1" << endl;
bool AmmoHax = false;
while(1) // Loops so the memory keeps rewriting itself if it's changed.
{
if (GetAsyncKeyState(VK_F1)) // If the "F1" hotkey is pressed then it will write the new data to the memory address.
AmmoHax = !AmmoHax;
if (AmmoHax)
WriteProcessMemory(trollpr0c3zz, (LPVOID)ammoAddr, &ammoAmount, sizeof(ammoAmount), NULL); // Modifies the ammunition's memory value to 10.
WriteProcessMemory(trollpr0c3zz, (LPVOID)roundsAddr, &roundsAmount, sizeof(roundsAmount), NULL); // Modifies the rounds' memory value to 60.
} // End of loop.
}
CloseHandle(trollpr0c3zz); // Removes access to the process when it is not needed.
}
system("pause");
return 0;
}
.