memory-module-loader is an implementation of a Windows loader that can load dynamic-link libraries (DLLs) directly from memory.
The loader exposed by the Windows operating system can only load modules from disk via
LoadLibraryEx. However, it is entirely possible to load libraries from memory instead. This is one such implementation. This loader supports loading resources. as well.
- Originally forked by Benjamin Dagana from https://github.com/fancycode/MemoryModule circa summer 2016.
- Updated by Ateeq Sharfuddin to support TLS.
- Updated by Jonathan Lim to support AMD64.
- Updated by Ateeq Sharfuddin to include example and documentation.
Please review the file LICENSE in this repository.
- The cloader project compiles into a static library.
- As an example, a small sample dll is provided.
- A sample executable is provided that links with the cloader. This executable loads sample-dll and calls a function.
Building from source
Open cloader.sln in Visual Studio 2019 and build the solution. The output will be placed under the
LoadLibrary, but loads the module from memory instead.
GetProcAddress, but usable only for modules loaded by
FreeLibrary, but use only for modules loaded by
FindResource, but use only to find resources in modules loaded by
LoadResource, but use only to load resources in modules loaded by
LoadModuleFromMemory. In this case, you do not need to call
LockResource: This function simply returns you the address of the resource instead of an HGLOBAL object.
Similar to SizeofResource, but use only for resources in modules loaded by
memory-module-loader | cloader.sln | LICENSE | README.md | \---src +---cloader | cloader.vcxproj | cloader.vcxproj.filters | common.h | moduleloader.c | moduleloader.h | +---sample-dll | common.h | dllmain.cpp | sample-dll.c | sample-dll.def | sample-dll.vcxproj | sample-dll.vcxproj.filters | \---sample-exe sample-exe.c sample-exe.vcxproj sample-exe.vcxproj.filters