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 


What am I doing wrong here? [Vb.net Multi-level Pointer]

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

Joined: 21 May 2012
Posts: 3

PostPosted: Tue May 22, 2012 6:00 am    Post subject: What am I doing wrong here? [Vb.net Multi-level Pointer] Reply with quote

Hello,
Im trying to read a value of a multi-level pointer using Vb.net but my result in VB comes out much different than the one in CE. I have tried this same method on other games and it works perfectly but not on THISONLINEGAME. The value is either something negative or 0.

Code:
  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 phandle As Integer
    Public gbaseid As Int32
    Public GAMEEXE As String = "tqit"
    Private m_hProcess As IntPtr = IntPtr.Zero
    Public Function ReadMemANdOffset()
        Dim THISONLINEGAMEProcess As Process = Process.GetProcessesByName(GAMEEXE)(0)
        Dim THISONLINEGAMEProcessMainIndex As Integer = 0


        For i = 0 To THISONLINEGAMEProcess.Modules.Count - 1
            If THISONLINEGAMEProcess.Modules.Item(i).ModuleName.ToLower = GAMEEXE Then
                THISONLINEGAMEProcessMainIndex = i

                Exit For
            End If
        Next

        phandle = THISONLINEGAMEProcess.Handle
        gbaseid = THISONLINEGAMEProcess.Modules.Item(THISONLINEGAMEProcessMainIndex).BaseAddress.ToInt32()

        Dim OFFSETS As String() = {"00115A00", "58", "484", "124", "710", "528"}
        Dim CurMem As Integer = 0
        Dim CurAdd As Integer = gbaseid

        For i As Integer = 0 To OFFSETS.Length - 1
            Dim CurOFFset As Int32 = Int32.Parse(OFFSETS(i), System.Globalization.NumberStyles.HexNumber)
            If i = 0 Then
                ReadProcessMemory(phandle, CurAdd + CurOFFset, CurMem, 4, 0)
            Else
                ReadProcessMemory(phandle, CurMem + CurOFFset, CurMem, 4, 0)
            End If
        Next
        Dim FinalResult As Integer = CurMem
        Return FinalResult

    End Function


Please advise, im stuck.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Tue May 22, 2012 7:43 am    Post subject: Reply with quote

Did you enable kernelmode memory access or use the virtualpagedir plugin to access the target's memory ?
If so, that might explain why it won't work for your program.

Besides that not really sure, perhaps a typo in one of the offsets ?

_________________
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
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