Possible Duplicate:
How can a C++ windows dll be merged into a C# application exe?
Is anybody aware of a program that can pack several DLL and a .EXE into one executable. I am not talking about .NET case here, I am talking about general DLLs, some of which I generate in C++, some of others are external DLL I have no control over.
My specific case is a python program packaged with py2exe, where I would like to "hide" the other DLL by packing them. The question is general enough though.
The things that had a look at:
- ILMerge: specific to .NET
- NETZ: specific to .NET
- UPX: does DLL compression but not multiple DLL + EXE packing
- FileJoiner:
Almost got it. It can pack executable + anything into one exe but when opened, it will launch the default opener for every file that was packed. So, if the user user dlldepend installed, it will launch it (becaues that's the default dll opener).
Maybe that's not possible ?
Summary of the answers:
DLL opening is managed by the OS, so packing DLL into executable means that at some point, they need to be extracted to a place where the OS can find them. No magic bullet.
So, what I want is not possible.
Unless...
We change something in the OS. Thanks Conrad for pointing me to ThinInstall, which virtualise the application and the OS loading mechanism. With ThinInstall, it is possible to pack everything in one exe (DLL, registry settings, ...).
You can use valgrid, thinstall or boxedapp.... I prefer the latter.
You can add the DLLs as binary resources in your EXE. At startup, your EXE can then extract the resources into a temporary folder, and
LoadLibrary()
the resulting DLLs.Have a look at BoxedApp. Good luck!
MoleBox Pro does exactly what you want, but it is shareware, and, unless you buy a full version, packed executables will show a Dialog Box at startup, saying something like "This file was packed by a trial version of MoleBox, please do not distribute it"
You can downliad it here: link
Unfortunately, I've been unable to find a fully satisfying and free solution
Try Powerpacker. Evalaze is another free virtualization solution. Enigma Virtual Box FREEWARE Edition
If the executable statically links to the DLL, i.e. there are no calls to
LoadLibrary
, then I don't think there are any mechanisms to pack the DLL into the executable since the DLL load is done by the OS application loader prior to the "main" function being called. The only way around this as far as I'm aware is to put the exe and the dlls into another exe. This wrapper exe unpacks the real exe and dlls into a temporary folder and starts the exe, deleting the files when the exe exits.If you are calling
LoadLibrary/Ex
to load the dll, extract the dll from the exe resources to a file prior to the call toLoadLibrary/Ex
.The real problem is that the
LoadLibrary
function does a lot of fixing up of addresses when the library is loaded and only works when loading from a file.