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 dealing with .dll base address

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

Joined: 09 Jan 2016
Posts: 4

PostPosted: Sat Jan 09, 2016 5:32 pm    Post subject: Help dealing with .dll base address Reply with quote

Hello! Iam creating a game trainer, using python, but i just got stuck finding its base address i only get "D2Game.dll"+000BE72C and alots of offsets, iam noob using this but i learned some stuff and thanksfully i get to there lol, some help will be appreciated, Thanks!!

PD:Here is a Screenshot, Sorry for my Bad english
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Sat Jan 09, 2016 5:37 pm    Post subject: Reply with quote

If that pointer truly works every time you restart the game, then "D2Game.dll"+000BE72C is your base address.
Back to top
View user's profile Send private message
EdoGaru
How do I cheat?
Reputation: 0

Joined: 09 Jan 2016
Posts: 4

PostPosted: Sat Jan 09, 2016 5:55 pm    Post subject: Reply with quote

Ty for fast replying hhhut,
and yes it is but, i cant insert "D2Game.dll"+000BE72C into my function i need a way to know the address of D2Game.dll :/

(i dont know if you understand what i want but iam trying u,u)
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Sat Jan 09, 2016 6:11 pm    Post subject: Reply with quote

Yeah, now I understand you, but since it's a DLL it is not always located on the same spot, so you've to write/search a function that gets the base address of a module first.

CREATTOOLHELP32SNAPSHOT should do here I think ...
Back to top
View user's profile Send private message
BanCheese
Cheater
Reputation: 0

Joined: 22 Oct 2014
Posts: 49

PostPosted: Sat Jan 09, 2016 7:00 pm    Post subject: Reply with quote

If you're planning on injecting code into the process that you want to find the base address for, this stack overflow question helped me a lot: http://stackoverflow.com/questions/4298331/exe-or-dll-image-base-address
_________________
A guy who likes memory hacking.
Back to top
View user's profile Send private message
EdoGaru
How do I cheat?
Reputation: 0

Joined: 09 Jan 2016
Posts: 4

PostPosted: Sun Jan 10, 2016 1:57 am    Post subject: Reply with quote

I have found a module that was made for hack/trainer thought, it helped me finding the module D2Game.dll base address now what do i do with it?

(Sorry for being so noob)

PD:If someone wish the library, the name of the library iam using is hackManager.
#You will need Python 2.7 for it to work properly
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Sun Jan 10, 2016 5:50 am    Post subject: Reply with quote

Well, to walk through the pointer qeue now is pretty simple:

- Make a variable (i.e. "address")
- Now assign the value of "D2Game.dll + 0xBE72C" to that variable
- Add the first offset 0x258 (addres += 0x258)
- Now read the memory from your variable "address"
- Add the second offset (0x1F8)
- Again read the memory from "address"
- Add the third offset (0x2F0)
- ...

Basically, if you watch your screenshot, CE already tells you what to do to follow that pointer ...
Back to top
View user's profile Send private message
EdoGaru
How do I cheat?
Reputation: 0

Joined: 09 Jan 2016
Posts: 4

PostPosted: Sun Jan 10, 2016 10:05 pm    Post subject: Reply with quote

Hello again and thanks you for replying hhuut Smile,

Well, there are some stuffs that i cant get clear like, after i sum up all the offsets with the starter pointer i get another pointer but when i try to modify it
nothing happens i think iam missing something or i need a tutorial to deal with .dll, also everytime i reload the game the .dll isnt static, (iam lost as hell, i need a tutorial about this topic that get me clear or if someone can help me out) all help will be appreciated thanks again guys Smile
Back to top
View user's profile Send private message
mgostIH
Expert Cheater
Reputation: 3

Joined: 01 Jan 2016
Posts: 159

PostPosted: Mon Jan 11, 2016 11:20 am    Post subject: Reply with quote

EdoGaru wrote:
Hello again and thanks you for replying hhuut :),

Well, there are some stuffs that i cant get clear like, after i sum up all the offsets with the starter pointer i get another pointer but when i try to modify it
nothing happens i think iam missing something or i need a tutorial to deal with .dll, also everytime i reload the game the .dll isnt static, (iam lost as hell, i need a tutorial about this topic that get me clear or if someone can help me out) all help will be appreciated thanks again guys :)


The only "problem" here is getting the .DLL starting address.
Once you got that, you can just add the first offsett of the dll (0xBE72C in your case) and read from that memory.
Once done, this will return the second pointer.
You add the offset to it (0x258) and read again from that new memory address.
Now you'll get the third pointer, you proceed in the same way, adding the offset (0x1F8) and reading from it.
Proceed on the fourth (0x2F0), the fifth (0x718), and finally, after reading from the sixth (0x6b8), you'll get your desired base address.

If you didn't understand, try finding pointers that require less offsets.

_________________
Do you need to ask me something? Feel free to join my discord server at: https://discord.gg/At4VZXA or ask me something in my YouTube channel: https://www.youtube.com/c/mgostIH
Back to top
View user's profile Send private message
EdoGaru
How do I cheat?
Reputation: 0

Joined: 09 Jan 2016
Posts: 4

PostPosted: Mon Jan 11, 2016 9:30 pm    Post subject: Reply with quote

Ty! after a couple of hours i make it i had to write my own function to calculate offsets but Thanks, hhhuut, mgostIH and BanCheese

also here is the code on python of the function i write if someone wish to have it Smile,
Code:
def CalculateOffset(ModuleAddress, offsets=[]):
            if len(offsets) == 1:
                address = int(str(ModuleAddress), 0) + int(str(offsets[0]), 0)
                pointer = D.read_int(address)
                return hex(pointer[0])
            else:
                OBA = 0
                count = len(offsets)
                for i in offsets:
                    if OBA == 0: ModuleA = ModuleAddress
                   
                    address = int(str(ModuleA), 0) + int(str(i), 0)
                    pointer = D.read_int(address)
                    ModuleA = pointer[0]
                    OBA = 1
                    count -= 1
                    BaseAddress = pointer[1]
                return BaseAddress
 
#example here using hackManager Library
import hack
D = hack.Hack("Game.exe")
dictd = D.module_base_dict
D2GameDll = dictd.get("D2Game.dll")

#we want to find the gold we provide to the function the Dll address it is #dynamic but thanks to hackManager library we can deal with that.
#Also we give the starter offset and all the offsets
GoldVar = CalculateOffset(D2GameDll, offsets=[0xBE72C, 0x258, 0x1f8, 0x2f0, 0x718, 0x6b8])

D.write_int(int(str(GoldVar),0), 500)



And that's it, i might need help finding pointers for Byte Values <--HP values lol.
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Tue Jan 12, 2016 4:38 am    Post subject: Reply with quote

for bytes/shorts it's same thing for offsets.. only difference is the last offset de-reference w\e its called you read it as byte or short instead of 4 bytes which it normally reads. All the in-between offsets will have to remain reading 4 bytes because they are always addresses. I haven't had a chance to hack on 64-bit game but they might require always reading 8 byte address offsets.
_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
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