I have been having troubles updating file attributes and icon of the
executables generated by PAR Packer (I tried both tkpp and exe_update).
Following one of the posts, where Roderich referenced Win32::Exe->exe_update
and trying various options there, I came to know that module Win32::Exe too has
a known issue invoking windows API call UpdateResource which allows
manipulation of file resources/attributes such as icons etc. It seems that the
issue, opened in 2011 was never closed, please check
here<https://rt.cpan.org/Public/Bug/Display.html?id=69570>. To confirm that
this same issue was not causing the icon update to fail, I ran exe_update for
an executable not generated by PP and to my surprise, it worked just fine.
So, based upon my testing so far, I see that there's a mismatch between the way
PP prepares and writes the executables from .pl files and Win32::Exe reads it
back to change the icon i.e., executables generated by PP are not 'correctly
interpreted' by Win32::Exe->exe_update and as a result the executables get
corrupted during the update. Following additional tests highlight the
abnormality a bit further - I tried associating hello2.ico with my executable
(generated from PP) and this time, instead of crashing the updated application
started displaying a 'usage' error (highlighted below). Here's a console
snippet for your reference:
C:\Documents and Settings\kkhatri>pp -o hello.exe hello.pl
C:\Documents and Settings\kkhatri>hello
Hello world!
C:\Documents and Settings\kkhatri>exe_update --icon=hello2.ico hello.exe
C:\Documents and Settings\kkhatri>hello
Usage: hello [ -Alib.par ] [ -Idir ] [ -Mmodule ] [ src.par ] [ program.pl ]
hello [ -B|-b ] [-Ooutfile] src.par
C:\Documents and Settings\kkhatri>pp -o hello.exe hello.pl
C:\Documents and Settings\kkhatri>hello
Hello world!
C:\Documents and Settings\kkhatri>exe_update --icon=hello.ico hello.exe
C:\Documents and Settings\kkhatri>hello
---------------------------
C:\Documents and Settings\kkhatri\hello.exe
---------------------------
C:\Documents and Settings\kkhatri\hello.exe is not a valid Win32 application.
---------------------------
OK
---------------------------
Can someone please advise, if this is a known issue and is there a workaround?
I want to get icon of my executable changed either through pp or through
exe_update. Thanks.
Regards, Krishna