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 


DLL Injecting (through memory / plugin system)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
remedy1
Newbie cheater
Reputation: 0

Joined: 04 Aug 2015
Posts: 11

PostPosted: Tue Aug 04, 2015 3:12 am    Post subject: DLL Injecting (through memory / plugin system) Reply with quote

I wrote a CE plugin with Lazarus and the plugin system (fantastic system btw). It's called "myPlugin".

Everything is working great.

I now want to extend myPlugin and inject a DLL into a target process.

LoadLibrary would be the way to go.

However i don't want to distribute too many DLLs so i included them in the Resource of myPlugin.

Is there a way to inject the DLLs into a target process without writing them to the file system first?

Thanks for your time.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Aug 04, 2015 3:24 am    Post subject: Reply with quote

well, you could emulate what windows does when it loads a dll.
parse the PE header, allocate sections, copy contents of the file to the apropriate sections and fill in the relocation addresses
when done find tbe entrypoint and execute it telling it it's base address (dll init)
if it's 64 bit you'll have to make sure your dll uses vectored exceptions instead of structured exceptions (lazarus dlls use vectored exceptions so that's fine)

it's usually easier to just write the dll to the filesystem, or come with it from the start (so no need to delete when done, which won't happen when ce is force closed)

_________________
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
remedy1
Newbie cheater
Reputation: 0

Joined: 04 Aug 2015
Posts: 11

PostPosted: Tue Aug 04, 2015 3:51 am    Post subject: Reply with quote

Ah i thought that maybe CE already had such a injection technique.
But that sounds like fun!

I am planning on distributing >5 DLLs and giving we have x86 and x64 that would sum up to 10 DLLs.

That's the reason i don't want to place them on the filesystem. Also as you mentioned if someone force closes CE the DLLs would still be tho you wouldn't need them anymore.

I just had an intresting read over at:
joachim-bauch.(de)/tutorials/loading-a-dll-from-memory/

Which sounds exactly like you described.


I'll get onto it later today.

Maybe we can see something similar in a future release of CE?
Sounds like a great addition in functionality. Smile
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Aug 04, 2015 5:12 am    Post subject: Reply with quote

the forcedinjection plugin has something like that, but it's not 100% functional (probably the symbolhandler having issues with redirection exportnames)

https://github.com/cheat-engine/cheat-engine/tree/eb1428bb5218250e033aae95c5bb0d747be923dc/Cheat%20Engine/plugin/forcedinjection


Also, it's really not a big issue to have multiple dll's in it. E.g stealthedit has a dll it injects(for 32 and 64-bit), and it puts them in their own folder.

Code:

stealtedit.dll
injecteddlls
 + workerdll32.dll
 + workerdll64.dll

_________________
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
remedy1
Newbie cheater
Reputation: 0

Joined: 04 Aug 2015
Posts: 11

PostPosted: Tue Aug 04, 2015 7:13 am    Post subject: Reply with quote

Nice example. I'll build upon that!

You are probably right about extracting the DLLs in seperate folders.

But the idea has now grown on me so i'll implement the memory injecting through resources.

Thanks again for your input!
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8585
Location: 127.0.0.1

PostPosted: Tue Aug 04, 2015 11:22 am    Post subject: Reply with quote

The thing you are trying to accomplish is called manual mapping in the game hacking world. There are a handful of examples on a few other cheating sites you should be able to find easily via Google.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
remedy1
Newbie cheater
Reputation: 0

Joined: 04 Aug 2015
Posts: 11

PostPosted: Wed Aug 05, 2015 12:20 am    Post subject: Reply with quote

Thanks atom0s i will look that up as well!
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 Gamehacking 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