Investigating techniques for embedding dlls in .exe so that I can distribute a single .exe file even if the app consists of multiple dlls.
- A simple solution would be to unpack those libraries at startup (before they are used) to a fixed directory and set the load library path. Mark them as delay loaded.
- hook LoadLibraryA (W?) at startup, and special case it for the libraries we want to load. Potentially difficult
- hook CreateFile/Read/Close at startup. This is idea similar to LoadLibrary but works at a lower level (I assume LoadLibrary would call CreateFile/Read/Close to do its job)
- use https://www.joachim-bauch.de/tutorials/loading-a-dll-from-memory/ which is MemoryLoadLibrary(), https://github.com/fancycode/MemoryModule
- use https://www.codeproject.com/tips/430684/loading-win-dlls-manually-without-loadlibrary
Ways of hooking:
- https://github.com/rwfpl/rewolf-dllpackager/tree/master/src : a tool that packs dlls, hooks LoadLibraryA etc. functions
- https://nisdom.com/blog/2014/02/11/embedding-64-bit-binary-in-a-32-bit-windows-c-plus-plus-app/ : this is about including 64-bit version in 32-bit version and extracting it on startup
- http://pefrm-units.osdn.jp/pefrmdllembed.html : takes exe and dll and creates an exe with dll embedded
Go to index of articles.