Roderich Schupp wrote on 2012-02-23:
> 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.
> 

I'm pretty sure it's only the --icon part which causes the problem. I can 
reproduce the error by running a one-liner like this on a simple PAR executable 
called test.exe:

perl -MWin32::Exe -e "$e=Win32::Exe->new('C:\Temp\test.exe'); 
$e->update(icon=>'C:\Temp\newtest.ico')"

Before I run that command my test.exe runs fine, but afterwards it gives the 
"... is not a valid Win32 application" error.

Reply via email to