• March 09, 2010, 10:54:17 PM *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search

News:

Please support us more. :)

Author Topic: Making a basic hack  (Read 121 times)

Filterhead | Syst3m

  • (Retired?) Programmer
  • Administrator
  • Hero Member
  • *****
  • Reputation: 1350
  • Posts: 604
    • View Profile
    • WWW
Making a basic hack
« on: December 19, 2009, 10:55:40 PM »
first things first; you need an address ( position in the memory of the game ) where a value is stored. You can use memory scanners like Cheat Engine to get this address.


Let's start.
first you need some code to get access to the process. Here's a function you can use. Remember to change the FindWindow parameter to the correct window name. ( This code should be placed above all other cores or declared in the header file. )
Code: [Select]
DWORD pID;
HANDLE hProcess;
void OpenMemory()
{
    HWND hWindow = FindWindow(0, "AirRivals_R");
    GetWindowThreadProcessId(hWindow, &pID);
    hProcess = OpenProcess(PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_VM_OPERATION, false, pID);
}

Now you can add some buttons on your form and double click on one, you'll see the code which will occur on an event.
Code: [Select]
void __fastcall TForm1::Button1Click(TObject *Sender)
{

}

Between the codeblock( { -> } ) you can place your specified code which will be executed while pressing the button.

to write a value into the game memory we will have to know what type of value and declare a variable of that type. Here's an example of an integer / float value.
Code: [Select]
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    //declare variables + assign values
    float value1 = Edit1->Textc.ToDouble(  );
    int value2 = Edit2->Textc.ToInt(  );
    unsigned short value3 = Edit3->Textc.ToInt(  );
    unsigned char value4 = Edit4->Textc.ToInt(  );

    //open our target process
    OpenProcessMemory(  );

    //write values to target process
    // WriteProcessMemory( Process handle, address, value, bytes of value ( sizeof or actual bytes ), NULL );
    //Float value
    WriteProcessMemory( hProcess, (LPVOID*)(DWORD)0x400000, &value1, sizeof(value1), NULL );  //bytes of valuetype => 4
    //Integer Value
    WriteProcessMemory( hProcess, (LPVOID*)(DWORD)0x400000, &value2, sizeof(value2), NULL );  //bytes of valuetype => 4
    //2 Bytes
    WriteProcessMemory( hProcess, (LPVOID*)(DWORD)0x400000, &value3, 2, NULL );  //bytes of valuetype => 2
    //1 Byte
    WriteProcessMemory( hProcess, (LPVOID*)(DWORD)0x400000, &value4, 1, NULL );  //bytes of valuetype => 1
}
 

It's not a noob friendly tutorial, so ask questions if you got some, I am too lazy to type a nice tutorial....
« Last Edit: December 19, 2009, 11:03:29 PM by Filterhead | Syst3m »
Logged

I <3 WING!

hoanghaidung

  • Newbie
  • *
  • Reputation: 13
  • Posts: 3
    • View Profile
    • WWW
Re: Making a basic hack
« Reply #1 on: January 08, 2010, 10:20:34 AM »
thank for the TUT.
it is exactly the first who the noob (like me) need to learn
P/S: maybe you creat a "thanks" button xD
Logged

JUSTICE MAY BE LIE, BUT I'M NOT!

Filterhead | Syst3m

  • (Retired?) Programmer
  • Administrator
  • Hero Member
  • *****
  • Reputation: 1350
  • Posts: 604
    • View Profile
    • WWW
Re: Making a basic hack
« Reply #2 on: January 09, 2010, 04:25:23 AM »
hmm, this is for C++ builder 2009 though... didn't test any of the code for VC++. =O
Logged

I <3 WING!

hoanghaidung

  • Newbie
  • *
  • Reputation: 13
  • Posts: 3
    • View Profile
    • WWW
Re: Making a basic hack
« Reply #3 on: January 09, 2010, 04:37:13 AM »
the code
Code: [Select]
void __fastcall TForm1::Button1Click(TObject *Sender)
{

}

change to

Code: [Select]
void Button1Click(TObject *Sender)
{

}


then it works on VC++
Logged

JUSTICE MAY BE LIE, BUT I'M NOT!