Has someone already mentioned the possibility to wrap all resources
(executable, libraries, data files) in another executable? There are
tools around to generate some char arrays from files. This way you
could import all resources into another executable which writes these
resources to a temporary folder and executes the program.
I did. I have a working prototype already. It will find (using fnkdat)
some place to decompress all entries of the .tar.bz2 file appended to
the executable, decompress everything mantaining the directory structure
of the tar file, call main.exe and enter a loop (with an appropriate
Sleep call) to wait for main.exe to end. When it does, all files are
Standard streams (stdin, out and err) are passed to main.exe so it
doesn’t open any console window while being able to write to an existing
console if main.exe was compiled as a console application and uses
[f]printf. All arguments passed to the utility via the command line are
also passed to main.exe untouched.
Right now I’m trying to reduce the memory usage of the program. It’s
only ~100 KiB in size, but uses ~3 MiB of RAM while waiting for main.exe
to end. I’m not convinced that it’s that bad though. I’ll release the
utility when I think it’s ready for prime time.