Packing an exe + dll into one executable (not .NET

2019-01-16 11:35发布

问题:

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, ...).

回答1:

Have a look at Thinstall ThinApp



回答2:

Have a look at BoxedApp. Good luck!



回答3:

Try Powerpacker. Evalaze is another free virtualization solution. Enigma Virtual Box FREEWARE Edition



回答4:

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 to LoadLibrary/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.



回答5:

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.



回答6:

You can use valgrid, thinstall or boxedapp.... I prefer the latter.



回答7:

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



回答8:

Have you looked at my cheap-utility list?

There supposed to be several inexpensive (i.e., rather cheap) tools that would link non-net app's DLL(s) together, such as:

1.) Molebox Pro (eu 100) 2.) BitArt's Fusion ($160) 3.) VB Wrap ($100) 4.) PE Bundle ($30)

Additionally, at "www.oreans.com" you might find a protection-oriented program bundle for eu 320, that, as they claim, can link either Win32 or ".Net" files together; however, when I asked them for a specific scenarion, where I would use their "XBundler For Win32/.NET" in order to pack a ".Net" EXE, and then would try to run it on Windos 98 (without the framework), they said it wouldn't work. :-(

EXE Admirer



回答9:

I was told it is possible to ask a shared object link to another shared object thus combine them into one in Linux

But it won't work for Windows native dlls, one thing occurrs to me is we can just use the linker to link all the objs together, regardless of which project they belongs to originally. Of course, they need to have similar link options.



标签: dll