Skip to content

About

DLL Injector (LoadLibrary) in C++ (x86 / x64) - LoadLibrary DLL injector

Topics

Resources

Stars

190 stars

Watchers

3 watching

Forks

Latest commit

 

History

26 Commits

Folders and files

Repository files navigation

DLL Injector

LoadLibrary DLL injector in C++ (x86 / x64)

Language Platform Arch License: GPL v3


DLL Injector loads a DLL into a running Windows process using the most basic technique: a remote thread that calls LoadLibraryW.

The code is split into a small injector library and a thin command-line front end, so you can use it as a tool or reuse the library in your own project.

Example

DEMO.mp4

Features

Targets

  • x86 and x64, Debug and Release
  • Target a process by executable name or by PID
  • Test programs (x86 / x64) available in the "Release" section

Injection

  • Waits for the remote thread and reports the injection outcome
  • Detects an architecture mismatch between the injector and the target
  • Unicode entry point and wide Win32 APIs, with readable error messages
  • Distinct exit codes for scripting

Code

  • Reusable library in include/injector/ and src/
  • RAII handle wrapper, no leaked handles
  • Visual Studio solution

Usage

inject.exe <dll> <process>
  • <dll>: path to the DLL to inject (absolute or relative).
  • <process>: target executable name (e.g. notepad.exe) or a numeric PID.
inject.exe test.dll notepad.exe
inject.exe test.dll 1234

Use -h / --help to display the usage.

Warning

The injector architecture must match the target process's architecture. An x86 injector cannot inject a 64-bit process and vice versa. The program detects a mismatch and reports it.

Exit codes

Code Meaning
0 Success
1 Usage error
2 Process not found
3 DLL path could not be resolved
4 Injection failed

Limitations

  • LoadLibrary is the most detectable injection technique; security products commonly flag it.
  • On 64-bit builds, the module handle returned by LoadLibrary is truncated to 32 bits by the remote thread exit code. The injection result (success or failure) is still reliable.

Build

  1. Open DLL Injector.sln.
  2. Build in Release (x86 or x64).

Every configuration is already set up.

License

This project is licensed under the GNU GPLv3.

About

DLL Injector (LoadLibrary) in C++ (x86 / x64) - LoadLibrary DLL injector

Topics

Resources

Stars

190 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages