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 


Module Addresses in [Visual Basic 2010]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
DDS
Expert Cheater
Reputation: 3

Joined: 10 Feb 2011
Posts: 112
Location: Bill's Planet

PostPosted: Sun Oct 09, 2011 3:22 pm    Post subject: Module Addresses in [Visual Basic 2010] Reply with quote

Hi all,
how can I enter Module Addresses in Visual Basic 2010 [for example: ClashOfHeroes.exe+0043EFB8 instead of 180EFB8]

I Know That I Have to + The Module base Address + 0043EFB8 In Order to get the Pointers Static Address
but Every Time I restart the Game The Static Address 180EFB8 Changes Locations

Another Example of What im Trying to do :

I Know this is the way is got to be Done.

Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Address As Integer
        ReadMemoryPointer("ClashOfHeroes", &H180EFB8, Address)
        Address += &HC
        ReadMemoryPointer("ClashOfHeroes", Address, Address)
        Address += &H0
        ReadMemoryPointer("ClashOfHeroes", Address, Address)
        Address += &H74C
        WriteMemoryPointer("ClashOfHeroes", Address, 99)
End Sub

In Order for my Trainer to Write 99 Moves in the Game but When i Restart
the Game the Trainer Wont Work, and the Only Reason i Know why the Static Address or the Module base Address Changes Location is because
i Looked 4 all the Addresses all Over Again and they Where Diferent

And this is what im trying 2 do

Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Address As Integer
        ReadMemoryPointer("ClashOfHeroes", ClashOfHeroes.exe+0043EFB8 , Address)
        Address += &HC
        ReadMemoryPointer("ClashOfHeroes", Address, Address)
        Address += &H0
        ReadMemoryPointer("ClashOfHeroes", Address, Address)
        Address += &H74C
        WriteMemoryPointer("ClashOfHeroes", Address, 99)
End Sub

Any Help Woul be Great Wink

Thx in Advance

_________________
elDarkDragonSlayer
Back to top
View user's profile Send private message Visit poster's website
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sun Oct 09, 2011 4:07 pm    Post subject: Reply with quote

Use GetModuleHandle to get the address of a loaded module
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sun Oct 09, 2011 4:40 pm    Post subject: Reply with quote

Slugsnack wrote:
Use GetModuleHandle to get the address of a loaded module

GetModuleHandle will only work if the module is loaded by the calling process. Since you're using the .NET framework, I'm assuming that this isn't going to be an injected DLL. You will need to transverse the module list.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Oct 09, 2011 5:34 pm    Post subject: Reply with quote

Given this is in .NET, you can just do this without the need of API using the Process class:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx

You can locate your process using:
Process.GetProcessesByName

Then with the returned Process object use Modules and loop them to see if the one you need resides in the collection.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
DDS
Expert Cheater
Reputation: 3

Joined: 10 Feb 2011
Posts: 112
Location: Bill's Planet

PostPosted: Sun Oct 09, 2011 7:23 pm    Post subject: Reply with quote

Can U Guys Give me some Code Examples 4 VB.NET
_________________
elDarkDragonSlayer
Back to top
View user's profile Send private message Visit poster's website
Unbr0ken
Advanced Cheater
Reputation: 2

Joined: 10 Aug 2011
Posts: 67

PostPosted: Sun Oct 09, 2011 8:21 pm    Post subject: Reply with quote

DarKDragonSlayer wrote:
Can U Guys Give me some Code Examples 4 VB.NET


C# example (Convert to VB.NET, is not so hard):

Code:
        static void Main()
        {
            try
            {
                Console.Write("Write the name of process to read: ");
                string pName = Console.ReadLine();
                Console.Write(string.Format("The process \"{0}\" is {1}", pName, (System.Diagnostics.Process.GetProcessesByName(pName)[0].HasExited) ? "not running!." : string.Format("running! - PID: {0:d4}\nBase Address of Main Module: {1:X8}", System.Diagnostics.Process.GetProcessesByName(pName)[0].Id, System.Diagnostics.Process.GetProcessesByName(pName)[0].MainModule.BaseAddress.ToInt32())));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.ReadKey();
        }


...
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Mon Oct 10, 2011 4:40 am    Post subject: Reply with quote

Going by what Wiccaan said, id do something like this

Code:
Public Function RetBase(ByVal ProcName As String, ByVal ModuleName As String) As Integer
        Dim P As Process() = Process.GetProcessesByName(ProcName)
        If (P.Length <> 0) Then
            Dim pMod As ProcessModuleCollection = P(0).Modules
            For i As Integer = pMod.Count - 1 To 0 Step -1
                If pMod.Item(i).FileName.EndsWith(ModuleName) Then
                    Return pMod.Item(i).BaseAddress.ToInt32
                End If
            Next i
        End If
        Return 0
    End Function


Your address would be
Code:
Dim Your_Addy As Integer = RetBase(ClashOfHeroes, ClashOfHeroes.exe) + &H43EFB8

It will also do any module in the collection.
Code:
Dim Module_Base As Integer = RetBase(ClashOfHeroes, Some_Module.dll)

_________________
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