Madsy / SelfLoader

Simple code to resolve library functions at runtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#SelfLoader

##About SelfLoader is a proof of concept of loading APIs on Windows from code without any imports, not even ntdll.dll or kernel32.dll. That is, code is completely self-hosted. When following all the rules (like you usually should), the bare minimum you need in order to import an external dependency is LoadLibraryW, FreeLibrary and GetProcAddress from kernel32.dll. SelfLoader can find the function pointers to these functions by reading the Process Environment Block (PEB), without depending on any APIs like kernel32.dll or the C runtime.

##Overview The Visual Studio project SelfLoader shows how to bootstrap LoadLibraryW, GetProcAddress and FreeLibrary, and uses those to get the function pointer to MessageBoxW from user32.dll. The other project EnumPEBModules, displays a bunch of information about the modules found via the PEB. For more information on the technique used, look at these links:

##Building Currently the repository only contains Visual Studio Express 2013 solution files. CMakeList.txt for CMake is coming soon. Building the Visual Studio projects requires NASM to be in your path. Link to the latest NASM Windows Installer

##Things to do Some effort used to find the correct TIB and PEB structure layouts for all the different versions of Windows would be nice, and could possibly change this code from being a curiosity into something that is half-way usable for some things.

About

Simple code to resolve library functions at runtime


Languages

Language:C 96.1%Language:Assembly 3.9%