On Wed, Feb 22, 2012 at 23:09, Mark Dootson <mark.doot...@znix.com> wrote: >> I read the pp code as concatenating chunks of the final exec onto itself > > I just checked latest code and there have been many updates in this area > since I last looked.
There was some weird code in there that definitely modified the "inner" executable stashed somewhere in the "outer" executable for "pp --gui" just to flip the wants-a-console-window bit in the executable header on both these executables. I took that out and now copy the relevant header byte at runtime from the outer executable to the inner executable, just after the latter has been extracted and before it is invoked. For that I reimplemented parts of PAR::Packer::_fix_console in C, see seek_to_subsystem in myldr/boot.c. I'm not sure which of inner or outer executable really produces the "not a valid Win32 executable" error. Note that the failing test does "pp --gui --icon ...". AFAICT Win32::Exe is not used to implement --gui, only for the --icon part. > As I'm the current keeper of the Win32:Exe dark magic, I'll take a look > tomorrow and post a fix, one way or the other. Thanks for looking into this. Cheers, Roderich