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 


[VB] ReadProcessMemory

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

Joined: 14 Apr 2007
Posts: 2

PostPosted: Sat Apr 14, 2007 11:24 am    Post subject: [VB] ReadProcessMemory Reply with quote

I'm use ReadProcessMemory to read Pointer in Step 8 Cheat Engine Tutorial

Code:
Private Sub cmdTest_Click()
    Dim Game As Long, ProcessID As Long, Handle As Long
    Dim lngTest1 As Long
   
    Handle = FindWindow("TForm9", "Step 8")
            If Handle <> 0 Then
                GetWindowThreadProcessId Handle, ProcessID
                hProc = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID)
                If hProc <> 0 Then
                    Dim lngAddress As Long
                    lngAddress = &H45CC18 + &HC
                    ReadProcessMemory hProc, lngAddress, VarPtr(lngTest1), 4, 0&
                    MsgBox lngTest1
                End If
             End If
End Sub


But it's return 0.
If i change
Code:
                    ReadProcessMemory hProc, lngAddress, lngTest1, 4, 0&

to
Code:
                    ReadProcessMemory hProc, lngAddress, lngTest1, 3, 0&


It's return FFFFFF.

So how can i read 4 byte value from an address. Question

----------------------
I'm not good at English.So..... Arrow
Back to top
View user's profile Send private message
stealthy17
Expert Cheater
Reputation: 0

Joined: 10 Apr 2007
Posts: 144
Location: The Netherlands

PostPosted: Sat Apr 14, 2007 4:08 pm    Post subject: Reply with quote

Code:
Private Sub cmdTest_Click()
    Dim Game As Long, ProcessID As Long, Handle As Long
    Dim lngTest1 As Long
   
    Handle = FindWindow("TForm9", "Step 8")
            If Handle <> 0 Then
                GetWindowThreadProcessId Handle, ProcessID
                hProc = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID)
                If hProc <> 0 Then
                    Dim lngAddress As Long
                    lngAddress = &H45CC18 + &HC
                    ReadProcessMemory hProc, lngAddress, lngTest1, 4, 0&
                    MsgBox lngTest1
                End If
             End If
End Sub


This should work just fine by the looks of it ...
It reads 4 bytes from &H45CC18 + &HC which is &H45CC24 and stores the value in lngTest1.
I don't know why you used VarPtr =/
Back to top
View user's profile Send private message
Hanamichi
How do I cheat?
Reputation: 0

Joined: 14 Apr 2007
Posts: 2

PostPosted: Tue Apr 17, 2007 10:18 am    Post subject: Reply with quote

Quote:
This should work just fine by the looks of it ...


But it give me bad result when i run.
Sad
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