Resources to get started for DLL injection?

Hi! I’ve been wanting to try my hand at DLL injection for a while, but could never find much documentation and eventually gave up on the idea.

I’d love to get games running at higher resolutions (not limited to D3D11 games) and fix some issues in others so developing plugins for SpecialK sounds like a good idea, but even then I doubt I’ll get far without any clue about where to start and studying its code probably won’t give the full story.
I assume knowledge of the underlying APIs is necessary, but are there good online resources to avoid buying expensive books? I also remember Kaldaien talking about profiling, so I can only assume that’s part of the reverse engineering process required to build mods and might require extra documentation. And I can’t find back Durante’s blog post about DLL injection… The only thing I’ve found is Nvidia’s recommendations for DX12 engines shared in another thread.

By the way, still in the same line of thought: I’d be interested if possible at all in knowing how to deal with the Yakuza series’s infamous memory management among other things, since Kaldaien seems to have given up on it (unless the process requires the equivalent of a book, in which case I’ll understand it’s not realistic).

In any case, thanks in advance!

1 Like

I wish I could name even a single book that touches on this subject, but they really don’t exist. Code injection is just something you figure out after you’re familiar enough with the technical workings of compiled code and Operating Systems.

For resolution overrides and so forth, a little bit of knowledge of graphics APIs is probably handy, but not necessary. I had 15+ years of experience with OpenGL prior to doing any game mods - I’ve used all of 5 minutes of OpenGL for all the games I have modified, and all the rest was done with D3D9/11/12 an API I had no professional experience with. If you enjoy reading API documentation and specifications, this should come naturally :slight_smile:

Regarding profiling (code you did not write), no… that’s not really a skill that most game modders use. I think static analysis (disassembly/decompile) and general debugging (i.e. tracing access to and re-writing memory addresses using CheatEngine) are more the typical skill set.


I’d recommend you study up on DLL Code Injection, this is freely available information on the Internet ( that’s where I learned :stuck_out_tongue: ). I would also recommend you learn good DLL writing practices (particularly what is and is not allowed in DllMain, because so many game modders are doing bad stuff that’s every bit as wrong as the games I fix).

2 Likes

Don’t know if it’s relevant, but if you’ve ever heard of an “ASI loader” (they’re all the rage in the GTA modding scene apparently), that’s basically just a basic DLL injector that loads additional custom DLL files (with their extension renamed to ‘ASI’ instead) and calls the DLL files’ DLLMain functions to allow them to execute custom code within the process.

“ASI plugins” usually doesn’t wrap original calls of the game or graphics subsystem, so instead they hand over the “DLL injection” aspect to the ASI loader, and focus primarily on their own custom code.

A bit of a minor introduction in “ASI plugins”: GTA San Andreas and C++? How to create a .ASI file? Any tutorial? - GTA III, VC & SA - GTAForums


What approach works the best in a particular game often seems to be different. Many games seems to just require basic memory overrides here and there to enable higher resolutions, which can be done using an ASI plugin (which as mentioned is just a renamed DLL file that doesn’t need to wrap a system call of some sort), while for other games a different approach is needed.

For example, based on chatter on the PCGamingWiki Discord server, @KingKrouch seems to be working on a general-purpose DLL setup that would make it easier for them to create DLL based resolution/FOV mods that works through overwriting existing memory values of a game (which I understand could be located using a tool such as Cheat Engine). That sort of approach might also be feasible depending on the game.

Screenshot from KingKrouch as an example:

2 Likes

Thanks a lot for the recommendations! Guess I’ll study DLL writing and code injection, static analysis and debugging. I hope to find good resources easily x)

Also, I remember modders mentioning viewports (specifically for BlazBlue Centralfiction’s Improvement Mod), which seem useful or even necessary for resolution mods. I’ll look into that as well.

Silent ( https://cookieplmonster.github.io/ ) has done patch work on Yakuza games (e.g., Analyzing the official Yakuza 3, 4, 5 patches & SilentPatch update | Silent’s Blog ). They may be willing to discuss Yakuza with you, once you have a basic understanding of what you’re doing. Unsurprisingly, Special K is part of their toolkit for figuring out what a game is doing with its threads.