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 


Help PointerWrite (Multi-Levels pointers)

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

Joined: 15 Sep 2013
Posts: 6

PostPosted: Wed Oct 09, 2013 5:03 pm    Post subject: Help PointerWrite (Multi-Levels pointers) Reply with quote

I have tried already with 3 different modules up and go crazy Sad. Investigating've seen that all or most people use the Visual Studio 2010 Express or Full, to see me download the Express and still not work for me.

Here is one of the modules that I use:

Code:
VB.NET Module
'Author : Cless
'How to use Read/Write Pointer
'Example Read
'       Me.Text = ReadPointerInteger(Game exe name, &HPointer,&HOffset).ToString()
'
'       Me.Text = ReadPointerInteger("gta_sa", &HB71A38,&H540).ToString()
'       Or
'       Me.Text = ReadPointerInteger("gta_sa", &HB71A38,&H540,&H544).ToString()
'Example Write
'       WritePointerInteger(Game exe name,&HPointer,Value,&HOffset)
'
'       WritePointerInteger("gta_sa",&HB71A38,1000,&H540)
'       Or
'       WritePointerInteger("gta_sa",&HB71A38,1000,&H540, &H544)

Module Trainer
    Private Declare Function ReadMemoryByte Lib "kernel32" Alias "ReadProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Byte, Optional ByVal Size As Integer = 2, Optional ByRef Bytes As Integer = 0) As Byte
    Private Declare Function ReadMemoryInteger Lib "kernel32" Alias "ReadProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Integer, Optional ByVal Size As Integer = 4, Optional ByRef Bytes As Integer = 0) As Integer
    Private Declare Function ReadMemoryFloat Lib "kernel32" Alias "ReadProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Single, Optional ByVal Size As Integer = 4, Optional ByRef Bytes As Integer = 0) As Single
    Private Declare Function ReadMemoryDouble Lib "kernel32" Alias "ReadProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Double, Optional ByVal Size As Integer = 8, Optional ByRef Bytes As Integer = 0) As Double

    Private Declare Function WriteMemoryByte Lib "kernel32" Alias "WriteProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Byte, Optional ByVal Size As Integer = 2, Optional ByRef Bytes As Integer = 0) As Byte
    Private Declare Function WriteMemoryInteger Lib "kernel32" Alias "WriteProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Integer, Optional ByVal Size As Integer = 4, Optional ByRef Bytes As Integer = 0) As Integer
    Private Declare Function WriteMemoryFloat Lib "kernel32" Alias "WriteProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Single, Optional ByVal Size As Integer = 2, Optional ByRef Bytes As Integer = 0) As Single
    Private Declare Function WriteMemoryDouble Lib "kernel32" Alias "WriteProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Double, Optional ByVal Size As Integer = 2, Optional ByRef Bytes As Integer = 0) As Double

    Public Function ReadByte(ByVal EXENAME As String, ByVal Address As Integer) As Byte
        Dim Value As Byte
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                ReadMemoryByte(Handle, Address, Value)
            End If
        End If
        Return Value
    End Function

    Public Function ReadInteger(ByVal EXENAME As String, ByVal Address As Integer) As Integer
        Dim Value As Integer
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                ReadMemoryInteger(Handle, Address, Value)
            End If
        End If
        Return Value
    End Function

    Public Function ReadFloat(ByVal EXENAME As String, ByVal Address As Integer) As Single
        Dim Value As Single
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                ReadMemoryFloat(Handle, Address, Value)
            End If
        End If
        Return Value
    End Function

    Public Function ReadDouble(ByVal EXENAME As String, ByVal Address As Integer) As Double
        Dim Value As Double
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                ReadMemoryByte(Handle, Address, Value)
            End If
        End If
        Return Value
    End Function

    Public Function ReadPointerByte(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer()) As Byte
        Dim Value As Byte
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                ReadMemoryByte(Handle, Pointer, Value)
            End If
        Else
            MsgBox("can't find process")
        End If
        Return Value
    End Function

    Public Function ReadPointerInteger(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer() ) As Integer
        Dim Value As Integer
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                ReadMemoryInteger(Handle, Pointer, Value)
            End If
        End If
        Return Value
    End Function

    Public Function ReadPointerFloat(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer()) As Single
        Dim Value As Single
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                ReadMemoryFloat(Handle, Pointer, Value)
            End If
        End If
        Return Value
    End Function

    Public Function ReadPointerDouble(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer()) As Double
        Dim Value As Double
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                ReadMemoryDouble(Handle, Pointer, Value)
            End If
        End If
        Return Value
    End Function

    Public Sub WriteByte(ByVal EXENAME As String, ByVal Address As Integer, ByVal Value As Byte)
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                WriteMemoryByte(Handle, Address, Value)
            End If
        End If
    End Sub

    Public Sub WriteInteger(ByVal EXENAME As String, ByVal Address As Integer, ByVal Value As Integer)
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                WriteMemoryInteger(Handle, Address, Value)
            End If
        End If
    End Sub

    Public Sub WriteFloat(ByVal EXENAME As String, ByVal Address As Integer, ByVal Value As Single)
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                WriteMemoryFloat(Handle, Address, Value)
            End If
        End If
    End Sub

    Public Sub WriteDouble(ByVal EXENAME As String, ByVal Address As Integer, ByVal Value As Double)
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                WriteMemoryDouble(Handle, Address, Value)
            End If
        End If
    End Sub

    Public Sub WritePointerByte(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal Value As Byte, ByVal ParamArray Offset As Integer())
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                WriteMemoryByte(Handle, Pointer, Value)
            End If
        End If
    End Sub

    Public Sub WritePointerInteger(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal Value As Integer, ByVal ParamArray Offset As Integer())
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                WriteMemoryInteger(Handle, Pointer, Value)
            End If
        End If
    End Sub

    Public Sub WritePointerFloat(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal Value As Single, ByVal ParamArray Offset As Integer())
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                WriteMemoryFloat(Handle, Pointer, Value)
            End If
        End If
    End Sub

    Public Sub WritePointerDouble(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal Value As Double, ByVal ParamArray Offset As Integer())
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                WriteMemoryDouble(Handle, Pointer, Value)
            End If
        End If
    End Sub
End Module


And to write in memory:

Code:
WritePointerInteger("proceso",&HBaseaddress,Valor,&HOffset1, &HOffset2, &HOffset3, &HOffset4)


But only wroks with pointers lvl1 :l

---------------------------------------------------------------------------------------------------------------------------------------------

I tried reading the memory and adding the offsets to the base address with this module, but still dont working

Code:

Code:
Dim Adress As Integer = ReadPointerInteger("SpiderSolitaire", &H942B8)
        Adress = ReadPointerInteger("SpiderSolitaire", &H942B8 + &H10)
        Adress = ReadPointerInteger("SpiderSolitaire", &H942B8 + &H7C)
        Adress = ReadPointerInteger("SpiderSolitaire", &H942B8 + &HC)
        Adress = ReadPointerInteger("SpiderSolitaire", &H942B8 + &H40)
        WritePointerInteger("SpiderSolitaire", Adress + &H74, 50000)


And

[CODE] Dim Address As Integer = ReadPointerInteger ("SpiderSolitaire", & )
Adress = ReadPointerInteger ("SpiderSolitaire", & Adress + & H10)
Adress = ReadPointerInteger ("SpiderSolitaire", &Adress + & H7C )
Adress = ReadPointerInteger ("SpiderSolitaire", & Adress + & HC)
Adress = ReadPointerInteger ("SpiderSolitaire", & Adress + & H40)
WritePointerInteger ("SpiderSolitaire" Adress + & H74, 50000) [/ CODE]

----------------------------------------------------------------------------------------------------------------------------

2

Try with the module Read / WriteMerobo found in many videos throughout the network

to write in memory:

[code]WriteDMAInteger("SpiderSolitaire", &H4942B8, Offsets:={&H10, &H7C, &HC, &H40, &H74}, Value:="50000000" Level:=5, nsize:=4)[/code]

----------------------------------------------------------------------------------------------------------------------------
3

Try a module which I found here is this:

Its Called Memory:

[code][code]'Memory hacking module, don't change anything here
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Imports System****

Module Memory

<DllImport("kernel32.dll")> _
Public Function ReadProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, <[In](), Out()> ByVal buffer As Byte(), ByVal size As UInt32, ByRef lpNumberOfBytesRead As IntPtr) As Int32
End Function

<DllImport("kernel32.dll")> _
Public Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, <[In](), Out()> ByVal buffer As Byte(), ByVal size As UInt32, ByRef lpNumberOfBytesWritten As IntPtr) As Int32
End Function

Public Function WriteInt32(ByVal P As Process, ByVal memAdr As Int32, ByVal value As Integer) As Boolean
Return WriteBytes(P, memAdr, BitConverter.GetBytes(value), 4)
End Function

Public Function ReadInt32(ByVal P As Process, ByVal memAdr As Int32) As Integer
Return BitConverter.ToInt32(ReadBytes(P, memAdr, 4), 0)
End Function

Public Function WriteShort(ByVal P As Process, ByVal memAdr As Int32, ByVal value As Short) As Boolean
Return WriteBytes(P, memAdr, BitConverter.GetBytes(value), 2)
End Function

Public Function ReadShort(ByVal P As Process, ByVal memAdr As Int32) As Short
Return BitConverter.ToInt16(ReadBytes(P, memAdr, 2), 0)
End Function

Public Function WriteFloat(ByVal P As Process, ByVal memAdr As Int32, ByVal value As Single) As Boolean
Return WriteBytes(P, memAdr, BitConverter.GetBytes(value), 4)
End Function

Public Function ReadFloat(ByVal P As Process, ByVal memAdr As Int32) As Single
Return BitConverter.ToSingle(ReadBytes(P, memAdr, 4), 0)
End Function

Public Function WriteByte(ByVal P As Process, ByVal memAdr As Int32, ByVal value As Byte) As Boolean
Return WriteBytes(P, memAdr, BitConverter.GetBytes(value), 1)
End Function

Public Function ReadByte(ByVal P As Process, ByVal memAdr As Int32) As Byte
Return BitConverter.ToString(ReadBytes(P, memAdr, 1), 0)
End Function

Private Function ReadBytes(ByVal P As Process, ByVal memAdr As Long, ByVal bytesToRead As UInteger) As Byte()
Dim ptrBytesRead As IntPtr
Dim buffer As Byte() = New Byte(bytesToRead - 1) {}
ReadProcessMemory(P.Handle, New IntPtr(memAdr), buffer, bytesToRead, ptrBytesRead)
Return buffer
End Function

Public Function WriteBytes(ByVal P As Process, ByVal memAdr As Long, ByVal bytes As Byte(), ByVal length As UInteger) As Boolean
Dim bytesWritten As IntPtr
Dim result As Integer = WriteProcessMemory(P.Handle, New IntPtr(memAdr), bytes, length, bytesWritten)
Return result <> 0
End Function

Public Function StrToByteArray(ByVal str As String) As Byte() 'Function to write Unicode text into the memory. Use it with the WriteBytes function like in the example: WriteBytes(p, Adr2 + &H0, StrToByteArray(TEXT), StrToByteArray(TEXT).Length)
Dim encoding As New System.Text.UnicodeEncoding() 'You may have to overwrite the string with 00 Bytes first to avoid a combination of the original and the new string as result, like if the new text is "One" and the old is "Blablabla"
Return encoding.GetBytes(str) 'after changing it would be "Oneblabla" and not "One" if you don't overwrite the old string. To overwrite it use this in the code BEFORE you overwrite it with the new text:
End Function 'WriteBytes(p, Adr1 + &H0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 24). Write two 0s for every letter of the old text, replace the 24 with the amount of 0s and don't forget to replace the &H0 with the last offset of your pointer.

End Module
[/code][/code]

With this:

[code][code]'Function for giving the program access to change values in the RAM
Module modTTInitializeProc
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As IntPtr, ByRef lpdwProcessId As Integer) As Integer
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Boolean, ByVal dwProcessId As Integer) As IntPtr
Public Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As IntPtr) As Boolean

Private PROCESS_ALL_ACCESS As Integer = &H1F0FFF

Public pstrClassName As String

Public Function InitProc(ByVal strClassName As String) As IntPtr
'Obtain the window handle by the window class
Dim hWnd As IntPtr = FindWindow(strClassName, vbNullString)
If hWnd = Nothing Then
Form1.HotkeyTimer.Stop()
Form1.RefreshTimer.Stop()
MessageBox.Show("Game window not found in the specified process! Closing...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Application.Exit()
Else 'If there is a handle
Dim pID As Integer
'Obtain the process id
GetWindowThreadProcessId(hWnd, pID)
'Obtain the handle of the process
Dim intTemp As IntPtr
intTemp = OpenProcess(PROCESS_ALL_ACCESS, False, pID)
InitProc = intTemp
End If
End Function
End Module
[/code][/code]

(All the credits of these modules to ccman32)

In form1:

[code]'Variables
Dim ProcessName As String = "Emuclient"
Dim WindowClass As String = "S4 Client" 'If you wanna hack another game than AVA you have to replace this string with the window class name of your game
'You can use google to find out how you can get the window class for the game you wanna hack with this trainer
'The easiest way to get the window class is by using WinSpy++ (Spy++)
Dim p As Process = Nothing
Dim RealName As String
Dim Xpos As Integer
Dim Ypos As Integer
Dim NewPoint As New System.Drawing.Point
Dim Panel1MouseDown As Boolean = False 'This variable was made to avoid bugs if the window gets moved while pressing the hotkey for setting it to center screen.[/code]

For inject or Write:

[code][code] Try
Dim Adr1 As Int32 = Memory.ReadInt32(p, &HB328B0) 'Address
Adr1 = Memory.ReadInt32(p, Adr1 + &H210) 'Offset1
Adr1 = Memory.ReadInt32(p, Adr1 + &HCool 'Offset2 (Add more offsets if needed)
Adr1 = Memory.ReadInt32(p, Adr1 + &H138) 'Offset1


'ATTENTION: The last offset MUST be added in the writing part (in this example the last offset is &H123)
'Replace the value (999) with what you want to change it to and the method (WriteInt32) with the method for the value type of the value you wanna change.
WriteInt32(p, Adr1 + &H90, 1167867904)

Catch ex As Exception 'If something failed
MessageBox.Show("Writing to memory failed: " & vbCrLf & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try[/code][/code]

----------------------------------------------------------------------------------------------------------------------------

Anything works for me, Somebody can help me? (Am using Visual Studio 2012 Full
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25785
Location: The netherlands

PostPosted: Wed Oct 09, 2013 5:10 pm    Post subject: Reply with quote

Read this:
http://forum.cheatengine.org/viewtopic.php?t=422516

it's an programming language independent explanation on how to use pointers, so you can implement it in a programming language you understand

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
jonnyHS
How do I cheat?
Reputation: 0

Joined: 15 Sep 2013
Posts: 6

PostPosted: Wed Oct 09, 2013 5:17 pm    Post subject: Reply with quote

Dark Byte wrote:
Read this:


it's an programming language independent explanation on how to use pointers, so you can implement it in a programming language you understand


I try doing that see:

Code:
Dim Adress As Integer = ReadPointerInteger("SpiderSolitaire", &H942B8)
        Adress = ReadPointerInteger("SpiderSolitaire", &H942B8 + &H10)
        Adress = ReadPointerInteger("SpiderSolitaire", &H942B8 + &H7C)
        Adress = ReadPointerInteger("SpiderSolitaire", &H942B8 + &HC)
        Adress = ReadPointerInteger("SpiderSolitaire", &H942B8 + &H40)
        WritePointerInteger("SpiderSolitaire", Adress + &H74, 50000)


but it din`t work :l

Edited

Code:
Dim a As Integer = &H1342B8
        Dim p As String = "SpiderSolitaire"

        Dim Adress As Integer = ReadPointerInteger(p, a)
        Adress = ReadPointerInteger(p, a + &H10)
        Adress = ReadPointerInteger(p, a)
        Adress = ReadPointerInteger(p, a + &H7C)
        Adress = ReadPointerInteger(p, a)
        Adress = ReadPointerInteger(p, a + &HC)
        Adress = ReadPointerInteger(p, a)
        Adress = ReadPointerInteger(p, a + &H40)
        Adress = ReadPointerInteger(p, a)
        Adress = ReadPointerInteger(p, a + &H74)

        Label1.Text = Adress


Always is 0 :l
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 programming 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