Skip to content

sonx4444/exe2dll

Repository files navigation

exe2dll

A small educational utility for converting compatible Windows PE executables (.exe) into dynamic-link libraries (.dll) by patching PE headers and injecting an export directory into existing code caves.

Overview

exe2dll:

  • validates the input with peforge
  • requires an existing relocation directory
  • sets the DLL characteristic
  • injects a minimal DllMain stub
  • preserves the original entry point as an exported function
  • reserves cave ranges during conversion to avoid overlapping writes

This is an educational binary-rewriting tool. It does not make every executable safe to load as a DLL.

Build

git clone --recurse-submodules https://github.com/sonx4444/exe2dll.git
cd exe2dll
build.bat

During peforge development, configure against a sibling checkout:

cmake -S . -B build-local -DPEFORGE_SOURCE_DIR=C:\path\to\peforge
cmake --build build-local --config Release

Usage

exe2dll_x64.exe <input_exe> <output_dll> <exported_function_name>

Example:

exe2dll_x64.exe test.exe test.dll Run

For a detailed walkthrough of the PE internals and conversion flow, read How to Convert EXEs to DLLs: PE Internals and Practical Steps.

License

MIT

About

A utility for converting Windows PE executables into dynamic-link libraries

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors