You are viewing our Forum Archives. To view or take place in current topics click here.
How do injectors actually work?
Posted:

How do injectors actually work?Posted:

-Deano
  • PC Master Race
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
I've been messing about with some programming stuff and was curious how things like DLL injectors work.

I've used a couple for games before but don't really understand HOW they work.
Like, what is it that actually allows the separate library to be ran within the game, how do people go about creating these, etc.

And, no, I'm not asking this because I want to go make some leet hax. Why bother when other people do it for me? .
I'm genuinely curious about the workings of it all.
#2. Posted:
speed
  • Retired Staff
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Well, take a minute to think about what a DLL is. It's just a library with a bunch of stuff that would be loaded into memory in a normal program, right?

So basically an injector does exactly what it's name describes. It injects the dll into the application's memory, as if it were actually a part of the application.
#3. Posted:
ObscureCoder
  • Resident Elite
Status: Offline
Joined: Jun 29, 201311Year Member
Posts: 211
Reputation Power: 13
Status: Offline
Joined: Jun 29, 201311Year Member
Posts: 211
Reputation Power: 13
The WinAPI has functions for procresses. Most notably: CreateRemoteThread which allows you to create a thread in the virtual address space of another process and from there you can use LoadLibrary to load a shared library (DLL) at runtime. As soon as the DLL is loaded, the entry point is called which is where people do things like edit the contents of memory addresses in real time for game exploiting etc. You can also use static addresses and cast a function pointer to an address in C/C++ and then execute it with parameters (essentially how RPC for console works except it does it remotely).
#4. Posted:
-Deano
  • Rated Awesome
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Ok, makes sense.

From what I've seen with a lot of the mods and such that I've used, all the scripts and such are created using Lua.

Why is this? Surely the game or whatever was created in C++ (most common for games) so shouldn't the mod also be created with C++.

I don't really get how creating a script/mod with Lua is compatible with something coded in a different programming language.
#5. Posted:
ObscureCoder
  • Resident Elite
Status: Offline
Joined: Jun 29, 201311Year Member
Posts: 211
Reputation Power: 13
Status: Offline
Joined: Jun 29, 201311Year Member
Posts: 211
Reputation Power: 13
-Deano wrote Ok, makes sense.

From what I've seen with a lot of the mods and such that I've used, all the scripts and such are created using Lua.

Why is this? Surely the game or whatever was created in C++ (most common for games) so shouldn't the mod also be created with C++.

I don't really get how creating a script/mod with Lua is compatible with something coded in a different programming language.


Game engines often write their core in C++ and then have an open API accessible from scripting languages. Lua and Python are commonly used. Lua is pretty lightweight and easy to embed. Basically, the scripting engine executes it and there will be native bindings for a lot of things in the game. Scripting languages are for productivity mostly.

Just think of it in an abstraction way. At the end of the day, every language executes binary ops on the CPU - how it translates and is executed from higher to lower level is the only part that matters.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.