Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Tukjedude's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    The Netherlands
    Posts
    25
    Reputation
    10
    Thanks
    13
    My Mood
    Sleepy

    [Tutorial] Basic C++ Game Hacking (Memory Editing)

    Basic C++ Game Hacking (Memory Editing)
    Hi All

    Some simple basic C++ game hacking (egg: memory editing)
    Ill start with one of the most simple codes:

    Code:
    #include <windows.h>
    
    int main() 
    {
    	HWND hWnd = FindWindow(0, "Calculator");
      	if(hWnd == 0)
    	{
        		MessageBox(0, "Error cannot find window.", "Error", MB_OK|MB_ICONERROR);
      	} 
    	else 
    	{
        		DWORD proccess_ID;
        		GetWindowThreadProcessId(hWnd, &proccess_ID);
        		HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proccess_ID);
        		if(!hProcess)
    		{
          			MessageBox(0, "Could not open the process!", "Error!", MB_OK|MB_ICONERROR);
        		} 
    		else 
    		{
          			int newdata = 500;
         		 	DWORD newdatasize = sizeof(newdata);
          			if(WriteProcessMemory(hProcess, (LPVOID)0x57C2A4, &newdata, newdatasize, NULL))
    			{
            				MessageBox(NULL, "WriteProcessMemory worked.", "Success", MB_OK + MB_ICONINFORMATION);
          			} 
    			else 
    			{
            				MessageBox(NULL, "Error cannot WriteProcessMemory!", "Error", MB_OK + MB_ICONERROR);
          			}
          			CloseHandle(hProcess);
        		}
      	}
      	return 0;
    }
    This will edit the following memory adress: 0x57C2A4
    In the calculator window,


    Code:
    HWND hWnd = FindWindow(0, "Calculator");
      	if(hWnd == 0)
    	{
        		MessageBox(0, "Error cannot find window.", "Error", MB_OK|MB_ICONERROR);
      	}
    The lines above will search for a window (proccess) to edit.
    In this case it is the calculator but if you want to edit the Cod4 Adresses it should be iw3mp!
    The if statement checks if the window is opened and exists. If not you will get a message that
    it can not be found.

    Scroll down til you see this line:
    Code:
    if(WriteProcessMemory(hProcess, (LPVOID)0x57C2A4, &newdata, newdatasize, NULL))
    0x57C2A4 is our adress, newdata is the value for our adressm and newdatasize is the bytes
    that the adress is (Most 4)
    So you could edit it to:

    Code:
    if(WriteProcessMemory(hProcess, (LPVOID)0x57C2A4, &567, 4, NULL))
    Wich will change the value to 567 with 4 bytes.


    Memory Adress freezing on request of Zyixc:

    So there is not a real code to freeze (egg FreezeAdress() it just don't exsist>
    But we can freeze it by using a infinite loop

    So we take the code wich edits the adress value:

    Code:
    if(WriteProcessMemory(hProcess, (LPVOID)0x57C2A4, &newdata, newdatasize, NULL))
    {
    // Here should be the message box that the change has worked, but you need to remove it when using a loop otherwise you will get a infinite msgbox xD
    }
    and put it in a infinite loop:
    Code:
    while(1);
    {
    	if(WriteProcessMemory(hProcess, (LPVOID)0x57C2A4, &newdata, newdatasize, NULL))
    	{
            				      			
    	}
    }
    The code above will freeze youre code by using a simple loop. There is a second wat but you have maxium of numbers a signed interger can hold so it wil stop working after some time so just use the loop above.

    Code:
    for (int i = 0; i >= 0; i++)
    {
    // here the code
    }

    I will continue updating the topic with more info on howto start game hacking in C++.
    A preview of how you can implent freezing adresses in the first code (on the top): https://pastebin.com/ATMUPjrq
    Last edited by Tukjedude; 05-31-2010 at 12:31 PM.

  2. The Following 6 Users Say Thank You to Tukjedude For This Useful Post:

    ac1d_buRn (06-07-2010),aleyro (06-01-2010),daavve (06-07-2010),lance_g24 (06-03-2010),leoisso (06-06-2010),reymon90 (06-05-2010)

  3. #2
    Zyixc's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    Geneva
    Posts
    359
    Reputation
    13
    Thanks
    225
    My Mood
    Yeehaw
    thanks i was looking for this thnx\!


    [IMG]https://www.mpgh.net/forum/members/560509-zyixc-albums-d/picture2910-******.png[/IMG]


    The stars that once lit my way have dimmed, the sky turned gray.
    The path, once so clear, faded away.

  4. #3
    Zyixc's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    Geneva
    Posts
    359
    Reputation
    13
    Thanks
    225
    My Mood
    Yeehaw
    Howto freeze an adresss ?

    ow it does automaticcaly
    but if i change weapon its gone


    sry for double post
    Last edited by Zyixc; 05-31-2010 at 10:29 AM.


    [IMG]https://www.mpgh.net/forum/members/560509-zyixc-albums-d/picture2910-******.png[/IMG]


    The stars that once lit my way have dimmed, the sky turned gray.
    The path, once so clear, faded away.

  5. #4
    Tukjedude's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    The Netherlands
    Posts
    25
    Reputation
    10
    Thanks
    13
    My Mood
    Sleepy
    First of all you can edit your post instead of double posting.
    Freezing adresses is a little more complicated but i Will write a tutorial voor it.
    Ill send you a message when its done.

    Sorry for bad typing im on the iPhone xD

    EDIT: For freeezing an adress isn't a code really. but if you put the following code:
    (Wich is part of the coe in my first post)
    Code:
                                                int newdata = 500;
         		 	DWORD newdatasize = sizeof(newdata);
          			if(WriteProcessMemory(hProcess, (LPVOID)0x57C2A4, &newdata, newdatasize, NULL))
    			{
            				MessageBox(NULL, "WriteProcessMemory worked.", "Success", MB_OK + MB_ICONINFORMATION);
          			} 
    			else 
    			{
            				MessageBox(NULL, "Error cannot WriteProcessMemory!", "Error", MB_OK + MB_ICONERROR);
          			}
          			CloseHandle(hProcess);
    Between:
    Code:
    for (int i = 0; i >= 0; i++)
    {
    // That code above here!
    }
    You get an infinite loop.. so the program will repeat the code between it.
    So it basicly freezes the adress..

    But i will add it to this tutorial.. be patient for a more extensive explaination..
    Last edited by Tukjedude; 05-31-2010 at 10:37 AM.

  6. The Following User Says Thank You to Tukjedude For This Useful Post:

    Zyixc (05-31-2010)

  7. #5
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Until i reaches the maximum number a signed integer can hold.

    Use while(1) instead
    Ah we-a blaze the fyah, make it bun dem!

  8. The Following 2 Users Say Thank You to Hell_Demon For This Useful Post:

    Melodia (05-31-2010),Tukjedude (05-31-2010)

  9. #6
    Tukjedude's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    The Netherlands
    Posts
    25
    Reputation
    10
    Thanks
    13
    My Mood
    Sleepy
    I know, read the update on my first post
    I already said that you can choose but you can use while(1);

  10. #7
    mwb1234's Avatar
    Join Date
    May 2009
    Gender
    male
    Posts
    460
    Reputation
    7
    Thanks
    65
    Good work, but you should remove the For statement loop, and say you must use a while(1) loop... a for loop will end eventually...

  11. #8
    Tukjedude's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    The Netherlands
    Posts
    25
    Reputation
    10
    Thanks
    13
    My Mood
    Sleepy
    Your'e right i'm not removing it completly.. but..just take a look :P

  12. #9
    mwb1234's Avatar
    Join Date
    May 2009
    Gender
    male
    Posts
    460
    Reputation
    7
    Thanks
    65
    Quote Originally Posted by Tukjedude View Post
    Your'e right i'm not removing it completly.. but..just take a look :P
    Remove it or die...

  13. #10
    Tukjedude's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    The Netherlands
    Posts
    25
    Reputation
    10
    Thanks
    13
    My Mood
    Sleepy
    Wtf why should i? Just shut up, and create your own tutorial if you don't like it..
    If it was a joke.. then i will die

  14. #11
    That0n3Guy's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    1,137
    Reputation
    13
    Thanks
    271
    My Mood
    Sleepy
    Code:
    #include <windows.h>
    
    int main() {
      HWND hWnd = FindWindow(0, "Calculator");
      if(hWnd == 0){
        MessageBox(0, "Error cannot find window.", "Error", MB_OK|MB_ICONERROR);
      } else {
        DWORD proccess_ID;
        GetWindowThreadProcessId(hWnd, &proccess_ID);
        HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proccess_ID);
        if(!hProcess){
          MessageBox(0, "Could not open the process!", "Error!", MB_OK|MB_ICONERROR);
        } else {
          int newdata = 500;
          DWORD newdatasize = sizeof(newdata);
          if(WriteProcessMemory(hProcess, (LPVOID)0x57C2A4, &newdata, newdatasize, NULL)){
            MessageBox(NULL, "WriteProcessMemory worked.", "Success", MB_OK + MB_ICONINFORMATION);
          } else {
            MessageBox(NULL, "Error cannot WriteProcessMemory!", "Error", MB_OK + MB_ICONERROR);
          }
          CloseHandle(hProcess);
        }
      }
      return 0;
    }
    That's also taken from another website, the code was originally posted February 14, 2009. I don't know how someone can claim to be a coder if they merely take source code from someone else, put their name on it, and claim it to be written by them. But I guess that's just how some people get by in life.
    Quotes Hall of Fame

    Quote Originally Posted by martijno0o0 View Post
    ok, i got visual basic 2008 and i got some expirients but i need c++ to make hacks rigth?
    so i need c++ and my question is!?¿? where i dontload it? and is c++ a own program or a update for vb08?
    [IMG]https://i660.photobucke*****m/albums/uu327/EddieTheWin/duff.png[/IMG]

  15. #12
    cruizrisner's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    381
    Reputation
    22
    Thanks
    48
    this is awesome thanks, hey can anyone give me an actual hack source code? (yes i will except a non working one) cuz i just want one for study

  16. #13
    That0n3Guy's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    1,137
    Reputation
    13
    Thanks
    271
    My Mood
    Sleepy
    Quote Originally Posted by cruizrisner View Post
    this is awesome thanks, hey can anyone give me an actual hack source code? (yes i will except a non working one) cuz i just want one for study
    He isn't a coder, he is a leecher.
    Quotes Hall of Fame

    Quote Originally Posted by martijno0o0 View Post
    ok, i got visual basic 2008 and i got some expirients but i need c++ to make hacks rigth?
    so i need c++ and my question is!?¿? where i dontload it? and is c++ a own program or a update for vb08?
    [IMG]https://i660.photobucke*****m/albums/uu327/EddieTheWin/duff.png[/IMG]

  17. #14
    Lakshay's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    www.MPGH.net // General // Crossfire
    Posts
    4,545
    Reputation
    335
    Thanks
    1,102
    My Mood
    Angelic
    Very nice Tut Go ahead!

  18. #15
    cruizrisner's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    381
    Reputation
    22
    Thanks
    48
    Quote Originally Posted by That0n3Guy View Post
    He isn't a coder, he is a leecher.
    my statement was addressed to everyone and i called nobody a coder

Page 1 of 2 12 LastLast

Similar Threads

  1. [Tutorial] Basic C++ Console hack
    By Erinador in forum C++/C Programming
    Replies: 12
    Last Post: 02-27-2010, 01:44 AM
  2. """Basic C++ Game Hacking"""
    By headsup in forum C++/C Programming
    Replies: 7
    Last Post: 06-08-2009, 12:41 PM
  3. """Basic C++ Game Hacking"""
    By headsup in forum Combat Arms Hacks & Cheats
    Replies: 5
    Last Post: 06-08-2009, 08:57 AM
  4. Replies: 28
    Last Post: 03-02-2009, 07:44 AM
  5. [Request]Tutorial on C++ Game Hacking
    By Propser in forum C++/C Programming
    Replies: 1
    Last Post: 10-30-2008, 02:55 AM