Hi,

I've got a partly working solution for PAR::Packer + Win32::Exe. Compiling the 'extracted Perl executable' in as a data resource means I can apply Icons and manifest privileges etc to the inner executable as well as the outer. I am properly disassembling and re-assembling the pp produced executables now so no more mangling. ( pp now always finds the bound files and 'PAR.pm' signature at the end of the file as expected).

Two issues remain.

1. MSVC execs still have problems - I'll figure out what this is. It occurs whenever a section increases in size so it is most likely some incorrect boundary padding. (So --icon is most common cause but --info could cause it too if the block size increases).

2. Now that I properly get the bound files and zip section re-added to the end of the exec, I get an apparentley harmless warning about:

'Format Error: bad signature ....' for every file extracted using Archive::Zip. I know this issue has been fixed before and wondered if someone could point me to a quick solution. I realise that it occurs because the zip contents are now at a different absolute offset in the file.( the inner 'Perl' executable can now change in size if I add icons to it - making the total 'boot exec' larger).

Regards

Mark



On 23/02/2012 17:56, Steve Hay wrote:
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