Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
C and C++ hacking programming reversing
You are Unregistered, please register to gain Full access.
This is a follow on to my tutorial of game hacking with Vb.net. All of the code here is mine and not copy/pasted. Credit will be given where due to people who helped me with things that i will now help you with.
Okay so here goes:
First, load up Visual Studio or whatever it is you use and create a new "Win32 Application", set Application type to "DLL" and tick "Empty project".
Now we are ready.
Create a new SOURCE file called "main.cpp" and inside that, type this at the very top:
In simple terms, it says, upon the attachment of this DLL to a process, create a new thread called "LoopFunction"
simple right......
Now, the reason we have created this thread is becuase we need to continually loop around so we can detect when a certain key has been pressed. We will come onto this later.
So, you need this code above the code you just typed:
This is defining a phrase as an array of bytes thus making our writeprocessmemory tasks much easier.
Once you have done that, put this underneath:
Code:
bool CrosshairOn = false;
Here we are using a boolean to determine or set the status of our hack. The reason we put it here is so that when we first attach our dll it sets the boolean to false, meaning out hack is not active. We will later set it to true so that our hack turns on.....
After that line, leave a few lines and paste:
Code:
HANDLE bf2142 = GetCurrentProcess();
Due to the fatc we are using a DLL we are already inside the process and therefore can get the pid and other things very easily using this line of code.
Here we are using our boolean.
Basically what it is doing is:
If the bool CrosshairOn = false then it knows that the hack is inactive and thus performs the writememoryprocesses using the correct array of bytes that will lock my X-Hair at all times. If it finds that the bool CrosshairOn = true, then it does the opposite and writes the original bytes back to the correct offsets, thus making my x-hair return to normal.
You can add other hacks by doing this:
Code:
if (GetAsyncKeyState(VK_F2)&0x80000)
{
}
your finished code will look something along the lines of:
Nice tutorial man, love it when guys actually make a tutorial instead of just posting code and saying have fun. Makes it easier on the guys trying to learn..
You might want to also tell people how the execute their first C+P hack because double clicking a Dynamic-Link Library will not make it magically write itself into a processes memory space and execute.
Thanks for posting something to help the newbies.
Quote:
Originally Posted by jjrose54
just post any questions
WriteProcessMemory(...) when your code is running inside the processes memory your editing? memcpy... pointers...
__________________
I've learned that something constructive comes from every defeat.
Sometimes i say things i shouldn't, and sometimes i say what other people are thinking.
Real programmer's don't document, if it was hard to write, it should be hard to understand.
First learn computer science and all the theory, next develop a programming style, then forget all that and just hack.
There is one thing off about this tutorial. Its that you give them the minimap yet you lock the X-Hairs. That may confuse a beginner and then they will come back with "It doesent work I get a error C2065: 'StandingOFF' : undeclared identifier error.
But still its a great tutorial for some beginners that have some background in what they are doing.
Very nice tutorial that gets right down to the bare stuff for beginners like me! I wish more tutorials were like this! Unforunately I don't play or have BF2142 so cannot test if I done it correctly!
I am currently reading several C++ books by Ivor Horton (currently half way through Beginning ANSI C++ and have Beginning Visual C++ 2008 set aside for after!) and Secrets of Reserve Engineering by Eldad Eilam. All recommended somewhere on this forum, I think. Only need to find some good D3D9 books now!
I've been surfing these forums for several months and having a read of source code, etc that I don't even have understand!
More tutorials like this but for CSS or BF2 would be very much appreciated and helpful!
1. question: Put the main.cpp to the Source files or to the root folder?
2. question: when I made the dll file where to put it or what to do with that?
1. question: Put the main.cpp to the Source files or to the root folder?
2. question: when I made the dll file where to put it or what to do with that?
Create a new empty dll in MS VC++.
In the Solution explorer you will see a directory tree, right click "Source Files" and press:
Add -> New Item -> C++ File (cpp)
name it "main.cpp" and put the code in there.
Once you have successfully compiled your dll, you need a program just as Winject so that you can 'Inject' your newly created dll into the procees of the game you wish to hack
You might want to also tell people how the execute their first C+P hack because double clicking a Dynamic-Link Library will not make it magically write itself into a processes memory space and execute.
Thanks for posting something to help the newbies.
WriteProcessMemory(...) when your code is running inside the processes memory your editing? memcpy... pointers...
Using WPM is essentially the same as virtual protect and memcpy. Depending on what your doing the overhead is not that big of deal. Maybe I am wrong. What is your resoning for memcpy rather than WPM? I mean we are coding for a windows environment so IDK.
Using WPM is essentially the same as virtual protect and memcpy. Depending on what your doing the overhead is not that big of deal. Maybe I am wrong. What is your resoning for memcpy rather than WPM? I mean we are coding for a windows environment so IDK.
Using WPM is essentially the same as virtual protect and memcpy. Depending on what your doing the overhead is not that big of deal. Maybe I am wrong. What is your resoning for memcpy rather than WPM? I mean we are coding for a windows environment so IDK.
A ) Anti-hack systems will hook WriteProcessMemory
B ) It's more proper, quicker, and doesn't make any calls the the kernel
C ) Looks neater, doesn't require a handle to the address space, also only has 3 params opposed to 5.
There are several other reasons, but I'm not writing a book on it :S
Not to get off-topic, great tut, only thing I disagree with is your use of WriteProcessMemory. Also, instead of including the whole std namepace in the cpp file, you really should only use it in functions that make constant use of it, like a logging function.
Last edited by AndrewThomas; 05-04-2009 at 12:56 AM.
1) You have the loop function in their twice, and they are both wrong anyway
2) When you get it to compile you don't have a dllmain so it won't work
3) Although i made a mistake in the tutorial and named something wrong, you have obvs just C&P all of it (badly may i add) and not realised the rather obvious mistake
This is a follow on to my tutorial of game hacking with Vb.net. All of the code here is mine and not copy/pasted. Credit will be given where due to people who helped me with things that i will now help you with.
Okay so here goes:
First, load up Visual Studio or whatever it is you use and create a new "Win32 Application", set Application type to "DLL" and tick "Empty project".
Now we are ready.
Create a new SOURCE file called "main.cpp" and inside that, type this at the very top:
In simple terms, it says, upon the attachment of this DLL to a process, create a new thread called "LoopFunction"
simple right......
Now, the reason we have created this thread is becuase we need to continually loop around so we can detect when a certain key has been pressed. We will come onto this later.
So, you need this code above the code you just typed:
This is defining a phrase as an array of bytes thus making our writeprocessmemory tasks much easier.
Once you have done that, put this underneath:
Code:
bool CrosshairOn = false;
Here we are using a boolean to determine or set the status of our hack. The reason we put it here is so that when we first attach our dll it sets the boolean to false, meaning out hack is not active. We will later set it to true so that our hack turns on.....
After that line, leave a few lines and paste:
Code:
HANDLE bf2142 = GetCurrentProcess();
Due to the fatc we are using a DLL we are already inside the process and therefore can get the pid and other things very easily using this line of code.
Here we are using our boolean.
Basically what it is doing is:
If the bool CrosshairOn = false then it knows that the hack is inactive and thus performs the writememoryprocesses using the correct array of bytes that will lock my X-Hair at all times. If it finds that the bool CrosshairOn = true, then it does the opposite and writes the original bytes back to the correct offsets, thus making my x-hair return to normal.
You can add other hacks by doing this:
Code:
if (GetAsyncKeyState(VK_F2)&0x80000)
{
}
your finished code will look something along the lines of: