Skip Menu |

This queue is for tickets about the Win32-Exe CPAN distribution.

Report information
The Basics
Id: 21348
Status: resolved
Priority: 0/
Queue: Win32-Exe

People
Owner: Nobody in particular
Requestors: john.xu [...] dothill.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Cannot found Win32::Exe::PE::Header::PE32Plus in win2003 R2 (X64) + CYGWIN
Date: Wed, 06 Sep 2006 18:49:17 +0800
To: bug-Win32-Exe [...] rt.cpan.org
From: "john.xu" <john.xu [...] dothill.com>
Download diskraid.e_
application/octet-stream 565k

Message body not shown because it is not plain text.

Download pe32plus.gif
image/gif 28.3k
pe32plus.gif
Hi, I am using the Win32::Exe module to get one exe file information. but I encount below problem. Here is the error message. Can't locate object method "load" via package "Win32::Exe::PE::Header::PE32Plus" at /usr/lib/perl5/site_perl/5.8.0/Parse/Binary.pm line 484. All I know information about the test: my machine is win2k3 R2, and cpu is AMD64. I attached an snapshot of my system info. I also attached the diskraid.exe file, but I renamed it to diskraid.e_. The Win32::Exe module version is: Win32-Exe-0.09.tar.gz, I download it from CPAN. $ uname -a CYGWIN_NT-5.2 x64-w2k3-john 1.5.5(0.94/3/2) 2003-09-20 16:31 i686 unknown unknown Cygwin root@x64-w2k3-john /cygdrive/f/workspace/si/vds_tester $ perl -v This is perl, v5.8.0 built for cygwin-multi-64int Copyright 1987-2002, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. $ set !D:='D:\cygwin\bin' !EXITCODE=00000000 ALLUSERSPROFILE='D:\Documents and Settings\All Users' APPDATA='D:\Documents and Settings\Administrator\Application Data' BASH=/usr/bin/bash BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release" [5]="i686-pc-cygwin") BASH_VERSION='2.05b.0(1)-release' CLUSTERLOG='D:\WINDOWS\Cluster\cluster.log' COLUMNS=95 COMMONPROGRAMFILES='D:\Program Files (x86)\Common Files' COMMONPROGRAMFILES(X86)='D:\Program Files (x86)\Common Files' COMMONPROGRAMW6432='D:\Program Files\Common Files' COMPUTERNAME=X64-W2K3-JOHN COMSPEC='D:\WINDOWS\system32\cmd.exe' CVS_RSH=/bin/ssh DIRSTACK=() EUID=500 FP_NO_HOST_CHECK=NO GROUPS=() HISTFILE=/home/Administrator/.bash_history HISTFILESIZE=500 HISTSIZE=500 HOME=/home/Administrator HOMEDRIVE=D: HOMEPATH='\Documents and Settings\Administrator' HOSTNAME=x64-w2k3-john HOSTTYPE=i686 IFS=$' \t\n' INFOPATH=/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/info:/usr/autotool/stable/inf o: JAVA_HOME='F:\j2sdk1.4.2' LINES=33 LOGONSERVER='\\X64-W2K3-JOHN' MACHTYPE=i686-pc-cygwin MAILCHECK=60 MAKE_MODE=unix MANPATH=/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man::/usr/X11R6/man:/usr/ssl/man NUMBER_OF_PROCESSORS=2 OLDPWD=/home/Administrator OPTERR=1 OPTIND=1 OS=Windows_NT OSTYPE=cygwin PATH='/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/d/WINDOWS/system32:/cygdrive/d/WINDOWS:/ cygdrive/d/WINDOWS/System32/Wbem:/cygdrive/d/Program Files (x86)/Microsoft Visual Studio 8/Common7/I DE/:/cygdrive/f/j2sdk1.4.2/bin' PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH' PIPESTATUS=([0]="0") PKG_CONFIG_PATH=:/usr/X11R6/lib/pkgconfig PPID=1 PRINTER='\\ROSE-TAN\hp LaserJet 1320 PCL 6' PROCESSOR_ARCHITECTURE=x86 PROCESSOR_ARCHITEW6432=AMD64 PROCESSOR_IDENTIFIER='AMD64 Family 15 Model 35 Stepping 2, AuthenticAMD' PROCESSOR_LEVEL=15 PROCESSOR_REVISION=2302 PROGRAMFILES='D:\Program Files (x86)' PROGRAMFILES(X86)='D:\Program Files (x86)' PROGRAMW6432='D:\Program Files' PROMPT='$P$G' PS1=$'\\[\\033]0;\\w\\007\n\\033[32m\\]\\u@\\h \\[\\033[33m\\w\\033[0m\\]\n$ ' PS2='> ' PS4='+ ' PWD=/cygdrive/f/workspace/si/vds_tester SESSIONNAME=Console SHELL=/bin/bash SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor SHLVL=1 SYSTEMDRIVE=D: SYSTEMROOT='D:\WINDOWS' TEMP=/cygdrive/d/DOCUME~1/ADMINI~1/LOCALS~1/Temp TERM=cygwin TEXMF='{/usr/share/lilypond/2.0.1,/usr/share/texmf}' TMP=/cygdrive/d/DOCUME~1/ADMINI~1/LOCALS~1/Temp UID=500 USER=root USERDOMAIN=X64-W2K3-JOHN USERNAME=Administrator USERPROFILE='D:\Documents and Settings\Administrator' VS80COMNTOOLS='D:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools\' WINDIR='D:\WINDOWS' X11PATH=/usr/X11R6/bin _=-v datadir=/usr/share/lilypond/2.0.1 f= May perl code is: use Win32::Exe my $diskraid_exe = Win32::Exe->new("/cygdrive/f/j2sdk1.4.2/bin/diskraid.exe"); my $currVer = $diskraid_exe->version_info->get('FileVersion'); And I found here no PE32Plus.pm file exist, here only PE32.pm exist. Thanks, John
It turns out that PE32Plus is the format for 64-bit executables. And unfortunately, the ability to handle it is still not included in Win32::Exe. That module could be added by another distribution if need be, I think. (I'm looking at Win32::Exe 0.11) Let me see if I can find some documentation on the format and get back to everybody involved - maybe with a .pm file ready to plug in.
Hi Curtis,

I have successfully patched Win32::Exe - please find enclosed
PE32Plus.pm and copy it into:
Win32-Exe-0.11\lib\Win32\Exe\PE\Header\PE32Plus.pm

In the end it was quite easy - very simple customising "constant
SUBFORMAT" according PE+ specification.

I have tested just very briefly but it seems to work well.

--
kmx
Subject: PE32Plus.pm
package Win32::Exe::PE::Header::PE32Plus; use strict; use base 'Win32::Exe::PE::Header'; use constant SUBFORMAT => ( ImageBase => 'a8', SectionAlign => 'V', FileAlign => 'V', OSMajor => 'v', OSMinor => 'v', UserMajor => 'v', UserMinor => 'v', SubsysMajor => 'v', SubsysMinor => 'v', _ => 'a4', ImageSize => 'V', HeaderSize => 'V', FileChecksum => 'V', SubsystemTypeId => 'v', DLLFlags => 'v', StackReserve => 'a8', StackCommit => 'a8', HeapReserve => 'a8', HeapCommit => 'a8', LoaderFlags => 'V', NumDataDirs => 'V', 'DataDirectory' => [ 'a8', '{$NumDataDirs}', 1 ], 'Section' => [ 'a40', '{$NumSections}', 1 ], Data => 'a*', ); ####### #Constant Value Description #IMAGE_SUBSYSTEM_UNKNOWN 0 An unknown subsystem #IMAGE_SUBSYSTEM_NATIVE 1 Device drivers and native Windows processes #IMAGE_SUBSYSTEM_WINDOWS_GUI 2 The Windows graphical user interface (GUI) subsystem #IMAGE_SUBSYSTEM_WINDOWS_CUI 3 The Windows character subsystem #IMAGE_SUBSYSTEM_POSIX_CUI 7 The Posix character subsystem #IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 Windows CE #IMAGE_SUBSYSTEM_EFI_APPLICATION 10 An Extensible Firmware Interface (EFI) application #IMAGE_SUBSYSTEM_EFI_BOOT_ SERVICE_DRIVER 11 An EFI driver with boot services #IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 An EFI driver with run-time services #IMAGE_SUBSYSTEM_EFI_ROM 13 An EFI ROM image #IMAGE_SUBSYSTEM_XBOX 14 XBOX use constant SUBSYSTEM_TYPES => [qw( _ native windows console _ _ _ posix _ windowsce )]; use constant ST_TO_ID => { map { (SUBSYSTEM_TYPES->[$_] => $_) } (0 .. $#{+SUBSYSTEM_TYPES}) }; use constant ID_TO_ST => { reverse %{+ST_TO_ID} }; sub st_to_id { my ($self, $name) = @_; return $name unless $name =~ /\D/; return(+ST_TO_ID->{lc($name)} || die "No such type: $name"); } sub id_to_st { my ($self, $id) = @_; return(+ID_TO_ST->{$id} || $id); } sub Subsystem { my ($self) = @_; return $self->id_to_st($self->SubsystemTypeId); } sub SetSubsystem { my ($self, $type) = @_; $self->SetSubsystemTypeId($self->st_to_id($type)); } 1;
On Thu Mar 25 05:03:54 2010, KMX wrote: Show quoted text
> Hi Curtis, > > I have successfully patched Win32::Exe - please find enclosed > PE32Plus.pm and copy it into: > Win32-Exe-0.11\lib\Win32\Exe\PE\Header\PE32Plus.pm > > In the end it was quite easy - very simple customising "constant > SUBFORMAT" according PE+ specification. > > I have tested just very briefly but it seems to work well.
This file is now in the svn for this (which is at svn.ali.as/cpan/trunk/Win32-Exe) and I just want to write a test that uses this before I make a release.
Hi, I asked on the PAR list if anyone was working on Win32::Exe. For some reason which now seems a bit stupid, I didn't think to look on the Win32::Exe bug list until after I'd completed a chunk of work. Anyhow, having done much the same work as KMX with regard to PE+, there is a developer release on CPAN - 0.12_01 The difference between the two implementations is that I have used quads in the pack / unpack format instead of 'a8'. This means that my implementation will only parse PE+ images on a 64 bit Perl. I'd like to be able to parse PE+ files on a 32 bit Perl - and I think all the quads are just file offsets so the significant part would not overflow in 32 bit Perl. The offsets change, of course, every time you write out a PE+ file. I know as far as pack is concerned a8 will be the same as a quad. It's using and recalculating the quad value in a 32 bit Perl that concerns me. So, I've gone for the easy solution - only parse PE+ images on 64 bit Perl. The major part of the release is work on manifest handling - which was broken. As KMX pointed out, PE+ is straightforward once you find the spec. Mark On Thu Mar 25 16:15:12 2010, CSJEWELL wrote: Show quoted text
> On Thu Mar 25 05:03:54 2010, KMX wrote:
> > Hi Curtis, > > > > I have successfully patched Win32::Exe - please find enclosed > > PE32Plus.pm and copy it into: > > Win32-Exe-0.11\lib\Win32\Exe\PE\Header\PE32Plus.pm > > > > In the end it was quite easy - very simple customising "constant > > SUBFORMAT" according PE+ specification. > > > > I have tested just very briefly but it seems to work well.
> > This file is now in the svn for this (which is at > svn.ali.as/cpan/trunk/Win32-Exe) and I just want to write a test that > uses this before I make a release. >
Hi, Just a note re my previous info regarding Quads. The five elements that use Quads in the PE+ structure will never be changed by Parse binary - and therefore never used in calculation. I was wrong to assume they were address offsets. Which means - 'a8' as a pack format will be fine - I'll use it in any actual release. On Thu Mar 25 16:15:12 2010, CSJEWELL wrote: Show quoted text
> On Thu Mar 25 05:03:54 2010, KMX wrote:
> > Hi Curtis, > > > > I have successfully patched Win32::Exe - please find enclosed > > PE32Plus.pm and copy it into: > > Win32-Exe-0.11\lib\Win32\Exe\PE\Header\PE32Plus.pm > > > > In the end it was quite easy - very simple customising "constant > > SUBFORMAT" according PE+ specification. > > > > I have tested just very briefly but it seems to work well.
> > This file is now in the svn for this (which is at > svn.ali.as/cpan/trunk/Win32-Exe) and I just want to write a test that > uses this before I make a release. >
Fixed in version 0.13. Used kmx's pack template (a8) for quads.