Basic hack and trainer with CE and Visual Basic
Requirements:
- - CheatEngine
- Microsoft Visual Basic 6
- The program/game you want to hack ( In this tutorial we use Microsoft Pinball )
The begin:
Ok, Start CheatEngine and Microsoft Pinball.
See the money value? Its zero if you start pinball. Just play a bit that the money value IS NOT 0 (zero)!
You see my score/money is 127750
Minimize Pinball and go to CheatEngine. If you see a tutorial window, just click it away. You see that the Little pc button is flashing, press it! You get now a window with processes and things, select pinball.exe.
You got now this:
Press OK! In the Value box you type your score/money of Pinball and press First Scan. You've now 2 addresses in the addresses box (if you're lucky) if not, just go further in pinball to score more, and then you go to CheatEngine and in the Value box you type your new score and press Next Scan!
You must have a window like this (value of adresses = the score you have):
Double click the addresses or click the red, to the right-down pointing button( ) to add the addresses to the downer box. So you can easily select them and change the values.
You now got this:
*Note: The addresses can be different!
*Note: you can change the descriptions to "Money Value" or something
Now we gonna change the score!
Double click the address under "Value" that you get a box with "Change this value to:" and a box with your score. Change this to anything you want! Do the same with the other rule (USE THE SAME VALUE!). You can freeze the values if you want with the check boxes under "Frozen", i do this. You got now this:
Test it!
Go to Pinball, play a bit, and if you do it right, the score is the same you got in CheatEngine.
*Note: It change if you in the wormhole or some other thing!
Else (if it's not changed at all or pinball crashed) , do it again!
The Real coding:
Start Visual Basic 6! Double Click on "Standard EXE", you got now a white form like this:
On the tab "Project" do "Add Module", you got now an window with the title "Add Module", Double click the "Module" (that image in the box)
You got now this:
[thumb]http://img261.imageshack.us/img261/8852/vbtut09.png[/thumb]
Add in the box this:
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Dim f1holder As Integer
Dim timer_pos As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal SomeValueIsStoredHere As Long, lpdwProcessId As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
Public Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Public Function WriteALong(TheGame As String, TheAddress As Long, ThisIsTheValue As Long)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
WriteProcessMemory SomeValue, TheAddress, ThisIsTheValue, 4, 0&
CloseHandle hProcess
End Function
Public Function ReadALong(TheGame As String, TheAddress As Long, TheValue As Long)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem SomeValue, TheAddress, TheValue, 4, 0&
CloseHandle hProcess
End Function
Public Function ReadAFloat(TheGame As String, TheAddress As Long, TheValue As Single)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem SomeValue, TheAddress, TheValue, 4, 0&
CloseHandle hProcess
End Function
Public Function WriteAFloat(TheGame As String, TheAddress As Long, ThisIsTheValue As Single)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
WriteProcessMemory SomeValue, TheAddress, ThisIsTheValue, 4, 0&
CloseHandle hProcess
End Function
'Code by Diamondo25
*Note: this a module from a warrock hack (dont use it, its detected)
Now, go to the main form, with tab "Window" > "1 Project1 - Form1(Code)" and add a button. DoubleClick the button that you just added. You now got something like this:
[thumb]http://img823.imageshack.us/img823/9216/vbtut10.png[/thumb]
Replace this:
Private Sub Command1_Click()
End Sub
with this:
Private Sub Command1_Click()
Call WriteALong("3D Pinball for Windows, Space Cadet", &HA12EF4, 999999)
Call WriteALong("3D Pinball for Windows, Space Cadet", &HB8AEBA, 999999)
End Sub
I gonna explain this rule for you:
Call WriteALong("3D Pinball for Windows, Space Cadet", &HB8AEBA, 999999): "Call WriteALong" is the function to Write a long (you use WriteALong if your value is larger then 10, else you use WriteAByte (not included in the module!) if its a float (A Float is a value like 1234.90922 ) you use WriteAFloat.) If you want to read a float/byte/long you use ReadALong/Float/Byte (Title of the window, The adress you want to scan, The dimmed value you want to post in), "3D Pinball for Windows, Space Cadet" is the window title, &HB8AEBA is the address (Read the note below!), "999999" is the value you want to set.
*Note: Add &H instead of the 2 00 (two zero's), Here's an example: Your address: 00L1FD4 You replace the 00 (two zero's) with an &H , then you got this: &HL1FD4
Now we gonna read the score value and we post it in a textbox.
Add a new button in your form AND a textbox (Here you can see the money value)! Double click the button with the name "Command2", now you got this code:
Private Sub Command1_Click()
Call WriteALong("3D Pinball for Windows, Space Cadet", &HA12EF4, 999999)
Call WriteALong("3D Pinball for Windows, Space Cadet", &HB8AEBA, 999999)
End Sub
Private Sub Command2_Click()
End Sub
You ADD below Private Sub Command2_Click() this:
Dim thevalue As Long
Call ReadALong("3D Pinball for Windows, Space Cadet", &HB8AEBA, thevalue)
Text1.Text = thevalue
As you see, the rule will read a long of the process with the title "3D Pinball for Windows, Space Cadet", looks for the address &HB8AEBA, and write it down in "thevalue" (what is a long), later, this value will be posted in the textbox with Text1.Text = thevalue
You got now something like this:
[thumb]http://img842.imageshack.us/img842/7905/vbtut11.png[/thumb]
if not, do it again!
Test the application with F5.
Here a pic off mine:
You can save the project with ctrl+s and make an EXE with the tab File -> Make Project1.exe...
Now you know the basics (i think)
Author: Diamondo25