// Alrighta, this will give you 99 lives in our game, Kondor1! // This is a very lame "hack", but you can learn how to use Read/WriteProccessMemory etc... // Wanna take a real look? Download Kondor1 and check this out, http://qsoft.ragestorm.com/projects/kondor/kondor.zip #include <windows.h> #include <stdio.h>
unsigned int LIVES = 99, CurrentLives = 0; #define LIVES_ADDR 0x83DE2DFC
HWND HKondorWnd = NULL; DWORD pID = 0;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { char GameName[120]; strcpy(GameName, "KONDOR"); GetConsoleTitle(GameName, sizeof(GameName)); // Yeah Kondor1 is under DOS... HKondorWnd = FindWindow("tty", GameName); if (!HKondorWnd) { MessageBox(NULL, "Kondor is not found!", "Kondor Trainer by QSoft", 0); return(0); }
// Get Kondor1's process ID GetWindowThreadProcessId(HKondorWnd, &pID);
// Open the process for read/write operation HANDLE pHandle = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_READ | PROCESS_VM_OPERATION, false, pID); if (!pHandle) { MessageBox(NULL, "Can't open process!", "Kondor Trainer by QSoft", 0); return(0); } // Get current number of lives if (!ReadProcessMemory(pHandle, (void *)LIVES_ADDR, (void *)&CurrentLives, 2, 0)) { MessageBox(NULL, "Can't read from process!", "Kondor Trainer by QSoft", 0); CloseHandle(pHandle); return(0); }
char tmp[256]; sprintf(tmp, "You have %d lives!", CurrentLives); MessageBox(NULL, tmp, "Kondor Trainer by QSoft", 0);
// Put new value of lives if (!WriteProcessMemory(pHandle, (void *)LIVES_ADDR, (void *)&LIVES, 2, 0)) { MessageBox(NULL, "Can't write to process!", "Kondor Trainer by QSoft", 0); CloseHandle(pHandle); return(0); } // Clean up CloseHandle(pHandle); MessageBox(NULL, "Ahanka Ahanka Baby!", "Kondor Trainer by QSoft", 0); return(1); } |