Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - Kondor Trainer
Author:Arkon
Category:Win32API
File Size:~ 1.87 KB
Uploaded at:27-Nov-02 02:58:44 pm
Description:
  This is a smiple trainer for our game Kondor, check it out! It shows how to write/read from proccess's memory.
  
// 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);
}
User Contributed Comments(None)
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[106236]
2D Rotated Rectangles Collision Detection[79393]
Keyboard Hook[68784]
UDP[52867]
HTTP Proxy[36098]

::Top 5 Samples::
2D ColDet Rotated Rectangles[10613]
PS2 Mouse Driver[6098]
Wave Format Player[4984]
Reading FAT12[4870]
CodeGuru[4561]


All rights reserved to RageStorm © 2009