Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to Make a Trainer With VB 2008?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
whoarere
How do I cheat?
Reputation: 0

Joined: 10 Jan 2009
Posts: 9

PostPosted: Wed Feb 04, 2009 11:18 pm    Post subject: How to Make a Trainer With VB 2008? Reply with quote

Alright, before you ask, yes I HAVE used the search engine,
and either I'm extremely suckish at Googling,
or there just simply isn't a tutorial for making a non-flash game trainer for VB 2008 out anywhere.
I've been having trouble with the V6 version (Overflow error), and all the mirrors for the fix from MS's database were broken (since 12 years has passed), so I'm wondering if anyone can help me with this.

So the code
Code:
Call WriteAInt(&H000000, &H000)

was for Visual Basic 5/6, and doesn't work on Visual Basic 2008.

Yes, I've looked at MSDN for WriteProcessMemory and found:
Code:
BOOL WINAPI WriteProcessMemory(
  __in   HANDLE hProcess,
  __in   LPVOID lpBaseAddress,
  __in   LPCVOID lpBuffer,
  __in   SIZE_T nSize,
  __out  SIZE_T *lpNumberOfBytesWritten
);


And... I know it works on C# and C++, but I'm wondering if the same function works for Visual Basic 2008 .NET?

Also, would the kernel from version 5/6 work for 2008 when I'm making the trainer, or is the syntax all different for the kernel too?

(I've tried searching for a base or a sample project that I can base mine out of, but I have found none. If anyone could provide me one, I'd be very grateful... I'm not going to steal your trainer, I just want to see how the whole program is supposed to be formed.)
Back to top
View user's profile Send private message
sh00ter999
Advanced Cheater
Reputation: 1

Joined: 17 May 2008
Posts: 89

PostPosted: Thu Feb 05, 2009 11:53 am    Post subject: Reply with quote

What do you want to add ?? 4Byte Adresses , pointers with offsets ?
I know another soultion in Vb2008 and i will tell you if you can tell me what kind of adresses you wanna add.

_________________
Hyes!
Back to top
View user's profile Send private message
whoarere
How do I cheat?
Reputation: 0

Joined: 10 Jan 2009
Posts: 9

PostPosted: Fri Feb 06, 2009 1:42 am    Post subject: Reply with quote

Well, I'm trying to modify 4 Byte adresses, and then use the timer to freeze it (I'm hoping the timer code will be the same at least?)
Back to top
View user's profile Send private message
sh00ter999
Advanced Cheater
Reputation: 1

Joined: 17 May 2008
Posts: 89

PostPosted: Fri Feb 06, 2009 4:54 am    Post subject: Reply with quote

Ok ill tell you my soltution :
Add a Module ( Hope you know how this works... if not : Go to Project -> Add Module ) and paste this in :

Code:

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function WriteFloatMemory Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function ReadFloat Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByRef buffer As Single, ByVal size As Int32, ByRef lpNumberOfBytesRead As Int32) As Boolean
Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public RBuff As Long
Public RBuff2 As Single
Public RBuff3 As Integer

Public Function Writememory (ByVal Address As Integer, ByVal Value As Long, ByVal Bytes As Integer)

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

WriteProcessMemory(processHandle, Address, Value, Bytes, Nothing)

CloseHandle(processHandle)

End Function

Public Function ReadFloat(ByVal Address As Single)

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

ReadProcessMemory(processHandle, Address, RBuff, 4, Nothing)

CloseHandle(processHandle)

Return RBuff

End Function

Public Function WriteFloat(ByVal Address As Integer, ByVal Value As Single)

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

WriteFloatMemory(processHandle, Address, Value, 4, Nothing)

CloseHandle(processHandle)

End Function

Public Function ReadLong(ByVal Address As Integer)

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

ReadProcessMemory(processHandle, Address, RBuff, 4, Nothing)

CloseHandle(processHandle)

Return RBuff

End Function

Public Function ReadFloatPointer(ByVal Base As Integer, ByVal Offset As Short)

Dim fullAddress As Long

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)

fullAddress = RBuff + Offset

ReadFloat(processHandle, fullAddress, RBuff2, 4, Nothing)

Return RBuff2

CloseHandle(processHandle)

End Function

Public Function ReadLongPointer(ByVal Base As Integer, ByVal Offset As Short, ByVal Bytes As Integer)

Dim fullAddress As Long

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)

fullAddress = RBuff + Offset

ReadProcessMemory(processHandle, fullAddress, RBuff3, Bytes, Nothing)

Return RBuff3

CloseHandle(processHandle)

End Function

Public Function WriteFloatPointer(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Single)

Dim fullAddress As Long

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)

fullAddress = RBuff + Offset

WriteFloatMemory(processHandle, fullAddress, Value, 4, Nothing)

CloseHandle(processHandle)

End Function

Public Function WriteLongPointer(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Long, ByVal Bytes As Integer)

Dim fullAddress As Long

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)

fullAddress = RBuff + Offset

WriteProcessMemory(processHandle, fullAddress, Value, Bytes, Nothing)

CloseHandle(processHandle)

End Function

Public Function NOP(ByVal Address As Integer, ByVal value As Integer)

Dim YourGameNameHERELookUp As Process() = Process.GetProcessesByName("YourGameNameHERE")

If YourGameNameHERELookUp.Length = 0 Then

End

End If

Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, YourGameNameHERELookUp(0).Id)

WriteProcessMemory(processHandle, Address, value, 1, Nothing)

CloseHandle(processHandle)

End Function



Then replace the YourGameNameHere with the process name of your game.
Note : write it like that ("Game")
Note2: NO .exe ! just the name

Then make 2 Button and a Timer
And then click once on your timer and then it should have this properties :
Screenshot

Then click on your 1. button an change its name to "On" or something like that and then doubleclick it and write this code in it :

Code:

Timer1.enabled=true


And wirte this in your second button (This will be the "Off" Button):

Code:

Timer1.enabled=false




Then double click on the timer and put this code in it :
Code:

WriteMemory(&H*ADRESS_HERE!*, *VALUE*, *Bytes*)

Hmm and then your selfmade GameTrainer in VisualBasic2008 should work Wink

_________________
Hyes!
Back to top
View user's profile Send private message
whoarere
How do I cheat?
Reputation: 0

Joined: 10 Jan 2009
Posts: 9

PostPosted: Fri Feb 06, 2009 5:32 pm    Post subject: Reply with quote

Wow thanks! That helped a lot Very Happy
There's just one problem... the program crashes whenever the timer pokes the adresses, so every 100 intervals...
Here's the error message I get:

Code:
************** Exception Text **************
System.OverflowException: Arithmatic operation resulted in an overflow.
   Location: HyperHalo.Module1.Writememory(Int32 Address, Int64 Value, Int32 Bytes) File C:\Users\MYUSERNAME\Documents\Visual Studio 2008\Projects\HyperHalo\HyperHalo\Module1.vb:Line 15
   Location: HyperHalo.HyperHalo.Timer1_Tick(Object sender, EventArgs e) File C:\Users\MYUSERNAME\Documents\Visual Studio 2008\Projects\HyperHalo\HyperHalo\HyperHalo.vb:Line 8
   Location: System.Windows.Forms.Timer.OnTick(EventArgs e)
   Location: System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   Location: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


I'm sorry, but I have Vista Ultimate K, so my errors are in Korean.
I translated it into English but the wording might be a bit different on an English computer.

Please help one more time Smile
The codes that cause the error seem to be:

in the Module...
Code:
Dim HaloLookUp As Process() = Process.GetProcessesByName("Halo")

in HyperHalo.vb...
Code:
Writememory(&H4BD7B03B, 4294966910, 4)


Thanks again!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites