MSL (migeel’s SmartLink) is a 32bit Windows DLL replacement with very similar structure. The reason why I created this format is that Windows is not able to load a DLL file which is not saved to a disk drive. libMSL was specially created for the needs of my PE-inject project, which uses it to run code from the injected DLL file.
The problem I had with PE-inject was that Windows API had no other way to load a DLL than by LoadLibrary(Ex) API call. LoadLibrary only allows you to load a library from a specified file, not from a specified memory location. The first approach that I made up was saving the DLL data into a file and then calling LoadLibrary. But this is not what I really wanted to do. I decided to make my own executable file format. And this is how MSL format was born.
MSL has some advantages above Windows standard for DLL files – the Portable Executable (PE) file format. The first one is size: MSL files can be several kilobytes smaller than their DLL originals. Second advantage is adaptability: because you have the source code of DLL to MSL convertor, MSL loader and other MSL related functions, you can modify them to satisfy your needs.
libMSL is open-source!
The whole MSL implementation is made with Delphi (with a pinch of Assembler), but it’s not hard to convert it to C/C++ (the hardest part is made with Assembler, which is portable enough, at least for x86 programming languages). The standard distribution includes a DLL version of libMSL, so you can call it’s functions from any Windows programming language. The distribution also contains a C header file and a demo program with source.
libMSL is distributed as public domain.