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 


problem with visual basic modules

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

Joined: 11 Jul 2012
Posts: 7

PostPosted: Wed Jul 11, 2012 2:38 pm    Post subject: problem with visual basic modules Reply with quote

i have a problem with these modules.

this is my code.

Code:
  Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Dim game As Process() = Process.GetProcessesByName("notepad")
        If game.Length = 0 Then
            MessageBox.Show("process is not rinning")
        Else
            Dim disgame As Integer = 0
            For i = 0 To game(0).Modules.Count - 1
                If game(0).Modules.Item(i).ModuleName = ("ADVAPI32.dll") Then
                    disgame = 0
                Else
                    disgame = 1
                    Exit For

                End If

            Next
            Dim baseid As Integer = game(0).Modules.Item(disgame).BaseAddress.ToInt64()
            MessageBox.Show(baseid)
            Dim amount As Int32 = 10
            Dim offsets As Int32 = +&HDB3B0
            Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, game(0).Id)
            ReadProcessMemory(processHandle, baseid, amount, 4, 0)
            MessageBox.Show(amount)
            WriteProcessMemory(processHandle, baseid + offsets, amount, 4, 0)
            MessageBox.Show(amount)
            CloseHandle(processHandle)


        End If
    End Sub


looking for ADVAPI32.dll offset DB3B0

value is 500 all the time.
try it out open up notepad in cheatengine and enter value 500 and there it is.

its does write but at the wrong place its writing at 00373130 offset db3b0
after restart notepad i can find it where its writing at hex 77620000
not at all i want to be.
what i diong wrong?
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Thu Jul 12, 2012 3:16 am    Post subject: Reply with quote

The reason it writes to the wrong address is you're not getting the correct module.
Code:
disgame = 0
Else
disgame = 1


Heres a simple function i just made for ya. It'l get the address for ya.
Paste that on your form.
Code:
    Public Function GetAddress(ByVal Address As Object, ByVal Processname As String) As Object
        Dim Proc As Process() = Process.GetProcessesByName(Processname)
        If Proc.Count = 0 Then
            MessageBox.Show("Process not found")
            Return -1
        End If
        If TypeOf Address Is String Then
            If (Address.IndexOf("+", StringComparison.Ordinal) = -1) Then
                Return Integer.Parse(Address, System.Globalization.NumberStyles.HexNumber)
            End If
            Dim tmp As String() = Address.Split("+")
            For Each M As ProcessModule In Proc(0).Modules
                If (M.ModuleName.ToLower = tmp(0).ToLower) Then
                    Return (M.BaseAddress.ToInt32 + Integer.Parse(tmp(1), System.Globalization.NumberStyles.HexNumber))
                End If
            Next
        End If
        Return -1
    End Function


Now on your button click event you can get the address like this
Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim MyAddress As Integer = GetAddress("ADVAPI32.dll+DB3B0", "notepad")
    End Sub


If it succeeds it'l return the address, else it'l return -1
Code:
        If MyAddress <> -1 Then
            'Do something
        End If

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

Joined: 11 Jul 2012
Posts: 7

PostPosted: Thu Jul 12, 2012 4:06 am    Post subject: Reply with quote

works great i never came up with that code oef...
But now i got a overflow writing to that value.
I hope i can figure that out . Shocked

yep dummy me notepad was nunning in x64.
its working like a charm.

Fanx for youre quick replay.
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