 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
martyn_10 How do I cheat?
Reputation: 0
Joined: 26 Jun 2010 Posts: 4
|
Posted: Mon Jun 28, 2010 5:06 am Post subject: looking for help with creating a trainer using VB |
|
|
Hi, i got some addresses from CE and was wondering if anyone could help me in creating a trainer using VB, i just want to know how to add the addresses and be able to modify them. I know there is a trainer creator included in CE but i would like to use VB so i can add other commands. Im using VB6. any help would be greatly appreciated or a link to a guide would be awesome, thanks.
I havnt used VB for some time so simple terms would be nice
|
|
| Back to top |
|
 |
rlange How do I cheat?
Reputation: 0
Joined: 26 Aug 2007 Posts: 9
|
Posted: Mon Jun 28, 2010 8:44 pm Post subject: |
|
|
At bare minimum you need to research the following API calls.
OpenProcess Lib "kernel32.dll"
ReadProcessMemory Lib "kernel32"
WriteProcessMemory Lib "kernel32"
CloseHandle Lib "kernel32.dll"
Basically you obtain a handle to the process via openprocess api call, and then use this handle when calling writeprocessmemory to overwrite the areas in memory you are targeting. If you need to walk a pointer path, or make decisions base on a value in memory, then readprocessmeory will come in handy. I have a couple of bots I've written in vb.net that you're more then welcome to look at. They cover all the basic concepts that are required to create a trainer (ie opening the process, reading addresses, writing to addresses, and converting results to different data types, etc...). They are in Vb.NET, so they wont directly compile with vb6, but only minor changes would need to be made, Mostly api declarations.
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Mon Jun 28, 2010 9:50 pm Post subject: |
|
|
Sure you can
VB is a different language, its not like C++ or C#. So with its differences, you can't include a library and use its functions / api's, you declare them internally. Make sure you have these functions declared:
- FindWindow
- GetThreadProcessId
- OpenProcess
- WriteProcessMemory
- CloseProcess
These are names of functions, you can go on MSDN to find out what they do.
There are many tutorials explaining on how to edit memory.
Well, rest is on you =/
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Jun 28, 2010 10:47 pm Post subject: |
|
|
| you have to deal with platform invoke in VB.NET and C# alike
|
|
| Back to top |
|
 |
Polynomial Grandmaster Cheater
Reputation: 5
Joined: 17 Feb 2008 Posts: 524 Location: Inside the Intel CET shadow stack
|
Posted: Tue Jun 29, 2010 10:42 am Post subject: |
|
|
| slovach wrote: | | you have to deal with platform invoke in VB.NET and C# alike |
He's using VB6, so PInvoke isn't an issue here.
Best advice I can give you is the following:
1) Learn how pointers work. You need to understand what a pointer is in terms of location and value too. For example, how does a pointer such as 0x02d334a0 + 0x22 + 0x3a + 0x4 translate into a real address? What makes an address static or dynamic? These things are important when learning how to deal with pointer structures, and even more important in understanding exactly how and why the game (or any other program) uses them.
2) Learn about API calls within the VB language. Learn to properly declare them using the Declare Function Foo Lib "somelib.dll" Alias RealFunctionName declaration, and what each part of it means. Find out how these calls are made in terms of the stack, and why we must always use the correct variable types - and more importantly why using the wrong ones will unbalance the stack. Find out the VB6-specific type names that match up to type names in C. Don't just assume that int in C is the same as Integer in VB6.
3) Look into the specific APIs mentioned above. FindWindow and GetWindowThreadProcessId are useful for finding the game's process ID from the title of the window. You can also use EnumProcesses to get a list of processes on the machine and find the process directly like that. Once you have the process ID, you can open a handle to the process using OpenProcess. Using that process handle, you can perform read/write operations in memory using the ReadProcessMemory and WriteProcessMemory APIs. Once you're done, use CloseProcess to close the process handle and free it.
There's plenty of resources out there for all of this in VB6, so it shouldn't be difficult to get a foothold in the subject. A quick Google search on specific APIs and keywords produces lots of good articles and sample code.
Hope this is some use to you.
_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time. |
|
| Back to top |
|
 |
martyn_10 How do I cheat?
Reputation: 0
Joined: 26 Jun 2010 Posts: 4
|
Posted: Tue Jun 29, 2010 9:33 pm Post subject: |
|
|
thanks for the help people. ive now been able to edit addresses. just trying to figure out how to use pointers now . If possible rlange a copy of one of your bots would be awesome help, especially if it deals with pointers
|
|
| Back to top |
|
 |
rlange How do I cheat?
Reputation: 0
Joined: 26 Aug 2007 Posts: 9
|
Posted: Wed Jun 30, 2010 12:53 am Post subject: |
|
|
pointers are read similar to regular values except you need to apply your offsets. This can generally be done with a loop, but I'll explain each step manually. I generally do it like this.
lets say your pointer looks like the following
STATIC ADDRESS = 0x4444
1ST OFFSET = 0x18
2ND OFFSET = 0x2C
DATA TYPE = SINGLE/FLOAT
You pointers static address is 0x4444, its 2 levels deep (0x18+0x2c), and the data type you are reading is single (decimal number).
First read the value of the static address as uint32. Lets say the value at address 0x4444 is 0x7777.
Next add your first offset 0x18 to the value you just read 0x7777, which would be 0x778F, this is your next address to read in the pointer chain.
Next read value at address 0x778F as uint32, lets say the value is 0x8888.
Next add your 2nd offsett 0x2c to the value you just read 0x8888, which would be 0x88B4, this is the next address to read in the pointer chain.
Since this was our last offset, the value at this address needs to be read as the data type you are looking to get. In this example my pointer points to a float/single data type, so I will read 4 bytes starting at address 0x88B4 and convert this to a single/float.
I have attached 2 small classes in a text file I use for reading addresses, pointers, and values in VB.NET.
The MemoryAddress class is a simple class that holds a base address and an array of ints it uses as offsets, if it is a pointer.
The manipulator class will open a process and then you can call readuint32 and readsingle functions passing in memoryaddress objects to read the value at the address or pointer.
Public Class MemoryAddress
'holds static address in the pointer, or regular address to read
Public StaticAddress As UInt32
'holds Offset list if any for pointers
Public Offsets As New List(Of UInt32)
Public Sub New()
End Sub
Public Sub New(ByVal BaseAddress As UInt32, ByVal Offsets As UInt32())
'Setting local static address value for new creation of memory address
Me.StaticAddress = BaseAddress
'looping around offset array adding them to local offsets list
For Each i As UInt32 In Offsets
Me.Offsets.Add(i)
Next
End Sub
End Class
Public Class MemoryManipulator
Public Process As Process
Public ProcessHandle As Integer
#Region "OPEN / CLOSE PROCESS"
Public Sub [Open](ByVal processName As String)
Try
Win32.Kernel32.Memory.CloseHandle(ProcessHandle)
Catch ex As Exception
End Try
Me.Process = Process.GetProcessesByName(processName)(0)
Me.ProcessHandle = Win32.Kernel32.Memory.OpenProcess(Win32.Kernel32.Memory.PROCESS_READ_WRITE_QUERY, False, Me.Process.Id)
End Sub
Public Sub [Close]()
Try
Win32.Kernel32.Memory.CloseHandle(ProcessHandle)
Catch ex As Exception
End Try
End Sub
#End Region
#Region "UINT32"
Public Function ReadUInt32(ByVal ptr As MemoryAddress) As UInt32
'If this is not a pointer then just read value of staticaddress as uint32
If ptr.Offsets.Count = 0 Then Return ReadUInt32(ptr.StaticAddress)
'If this is a pointer, read value at statci address
Dim ba As UInt32 = ReadUInt32(ptr.StaticAddress)
'init return value
Dim ret As UInt32 = 0
'getting count of offsets
Dim olen As Integer = ptr.Offsets.Count
'need to -2 because its 0 based array, and want to save last address to read as specific data type
'addresses are always read as uint32 which can differ from the datatype you are looking for
For oloop As Integer = 0 To olen - 2
'adding my current base address and offset and storing as base address
ba = ba + ptr.Offsets(oloop)
'reading value at address, storing as ba
ba = ReadUInt32(ba)
Next
'last address to read in pointer is actual value
ret = ReadUInt32(ba + ptr.Offsets(olen - 1))
Return ret
End Function
Public Function ReadUInt32(ByVal addr As UInt32) As UInt32
'init return value
Dim ret As UInt32 = 0
Try
'create buffer to read btyes into UINT32 requires 4 bytes
Dim buf(3) As Byte
'reading memory
Win32.Kernel32.Memory.ReadProcessMemory(ProcessHandle, addr, buf, buf.Length, Nothing)
'converting read bytes into UINT32
ret = BitConverter.ToUInt32(buf, 0)
Catch ex As Exception
End Try
'returning value
Return ret
End Function
#End Region
#Region "SINGLE"
Public Function ReadSingle(ByVal ptr As MemoryAddress) As Single
'If this is not a pointer then just read value of staticaddress as single
If ptr.Offsets.Count = 0 Then Return ReadSingle(ptr.StaticAddress)
'If this is a pointer, read value at static address
Dim ba As UInt32 = ReadUInt32(ptr.StaticAddress)
'init return value
Dim ret As Single = 0
'getting count of offsets
Dim olen As Integer = ptr.Offsets.Count
'need to -2 because its 0 based array, and want to save last address to read as specific data type
'addresses are always read as uint32 which can differ from the datatype you are looking for
For oloop As Integer = 0 To olen - 2
'reading value at baseaddress + offset and storing value in baseaddress
ba = ba + ptr.Offsets(oloop)
'reading value at new baseaddress and storing in base address
ba = ReadUInt32(ba)
Next
'last offset, need to read value as specific data type we are looking for
ret = ReadSingle(ba + ptr.Offsets(olen - 1))
'returning value
Return ret
End Function
Public Function ReadSingle(ByVal addr As UInt32) As Single
'init return value
Dim ret As Single = 0
Try
'creating buffer to read bytes. Single type requires 4 bytes
Dim buf(3) As Byte
'reading 4 bytes into buf byte array
Win32.Kernel32.Memory.ReadProcessMemory(ProcessHandle, addr, buf, buf.Length, Nothing)
'conveting 4 byte array to decimal value
ret = BitConverter.ToSingle(buf, 0)
Catch ex As Exception
End Try
'returning value
Return ret
End Function
end class
#End Region
|
|
| Back to top |
|
 |
|
|
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
|
|