Simple Loader

This project is the "Hello World" of Tradecraft Garden projects. It's a simple DLL loader created by refactoring Stephen Fewer's ReflectiveDLLInjection project.

Project Files

Notes

The loader.c file is the core logic of the project and a good starting place for writing other loaders.

tcg.h is a header for the Tradecraft Garden Library. This library contains functions for DLL loading, PICO running, resolving functions by walking the Export Address Table, and printf()-style debugging.

This project's loader.spec is a good baseline for most projects. It:

  • uses make pic +gofirst to put the go() function at the beginning of the program.
  • opts the PIC program into Dynamic Function Resolution with the dfr command. This feature has Crystal Palace dynamically insert code to call resolve in loader.c when a MODULE$Function (or GetProcAddress, LoadLibraryA) reference is found.
  • uses fixptrs with x86 PIC to fix incomplete pointers--giving us access to linked resources and strings without any special tricks.

License

This project is licensed under the BSD License.