Memory Editing Tutorial
[drumroll]Welcome to the Memory editing tutorial! [/drumroll]
Yes, I finally got round to make it.
What I've done in this tutorial is, that instead of getting down dirty with all the core concepts about this function, and that function, I've made a DLL file which has all required functions in a REALLY simplified manner.
This tutorial assumes that you know the basics about memory editing, what is a memory address, what are bytes etc. If you don't, then you got to learn them from somewhere, because I can't be offering that support in here.
This tutorial is only for the programming part of the trainer making or making anything involving memory editing. I'm NOT going to explain the different memory structures, methodologies etc. here. Strictly the programming part.
Alright, lets get started. All you have to do is this. In every project you want to do memory editing, you just have to include a reference to the DLL file I'm providing, and then bundle the DLL file along with the tool.
Here we go!
1. Open VB.NET express, and make a new solution.
2. In the solution explorer bar on the right, right click on the name of the solution, and click on add reference...
3. Then on the window that comes up, select the browse tab, and go to the folder where the MemConnect.dll file is located. Select it and press ok.
4. Then you're done with it, now to the programming part...
Add a button to your solution. We're going to be making a small minesweeper time changing program.
Note that I've hidden all the memory code from your eyes by using the DLL, so you don't have to worry about that!
In the code window, in the button click sub, use this code -
Code:
Dim connector As New MemConnect.connector()
What this code does is, that it declares a new memory connector, by giving the reference to the MemConnect file and using the connector function in that. In the Dim ____ as New MemConnect.connector(), you can fill anything in the ____ because it is a variable, but then you'll have to use that for the rest of the program.
Now that we've declared our memory connector, we need to find the Minesweeper game's process in the memory so we can edit it.
Code:
connector.setprocess("WINmine")
In this code, we use our connector again, and use the setprocess function I've made to set the program to use the Minesweeper process. WINmine is the exe name for Minesweeper, and for example it is cricket07.exe for cricket07. Note the cases, they are important, as capitals are different than lowers. We put the name in double quotes because it is a string.
Now that this line is executed, we've told the program to connect the connector class to the WINmine process, and it attaches itself. Now all we have to do is set the value at the required address.
Next is the writing the real value to it. We use the poke method for that, and the syntax for the API in the DLL is -
connector.poke(address of the value, the value to write, the number of bytes in the memory)
Here's the example code for all this -
Code:
connector.poke(&h100579C, 0, 1)
In this command, we use the method poke, and give the address. &h is the prefix used to specify a hex address. 0 is the value we want to write, and since we're writing only 1 byte we use the number 1.
Note that some people might say its better to assign memory privileges, but I've already included that command in the self made DLL file, so there's no worries!
Congratulations! Now you've finally edited a value in the memory! Also note, 100579C is the address in Minesweeper for storing the time, and I've found it out myself. Please don't ask how here, because as I said this thread is strictly for the programming discussion. For other tutorials on finding addresses and such, refer to
www.gamehacking.com .
Also, as a sidenote, I've also included Reading from the memory part in the DLL file, and to access it, we use the following code!
Code:
connector.read(address of the value, variable to store the value being read in, number of bytes)
That's all, with this it'll store the value in the address in the variable you specified!
Now this tutorial might look big and confusing but its just the simple things explained in detail for better understanding. If you observe carefully, the code is just 2 lines!
There are some error handlers in the DLL aswell, the use of which I will explain tomorrow, because its already been too long here and I don't want to scare people away.
Lets hope this tutorial helped you and that you enjoyed reading it and programming aswell! Lets see what good use you put this too...
And the DLL file is attached!