Win32::PEFile - Portable Executable File parser |
Win32::PEFile - Portable Executable File parser
use Win32::PEFile;
my $pe = Win32::PEFile->new (-file => 'someFile.exe');
print "someFile.exe has a entry point for EntryPoint1" if $pe->getEntryPoint ("EntryPoint1");
my $strings = $pe->getVersionStrings (); print "someFile.exe version $strings->{'ProductVersion'}\n";
Win32::PEFile provides the following public methods.
new (%parameters)
getSectionNames()
setMSDOSStub($stub)
$stub
contains the code as a raw binary blob.
getMSDOSStub()
The helper module Win32::PEFile::SectionHandlers provides handlers for various sections. At present only a few of the standard sections are handled and documented here. If there are sections that you would like to be able to manipulate that are not currently handled enter a ticket using CPAN's request tracker (see below).
Resource section. At present only access to the version resource is provided, although the other resources are parsed internally.
getVersionStrings ($language)
getVersionCount ($language)
getFixedVersionValues ($language)
getResourceData ($type, $name, $language)
If the preferred language is not available one of the available languages will be used instead.
Exports section.
getExportNames ()
getExportOrdinalsCount ()
haveExportEntry ($entryPointName)
getEntryPoint
($entryPointName)
is provided as an alias for haveExportEntry
($entryPointName)
.
getImportNames ()
getImportNamesArray ()
haveImportEntry ($entryPath)
'dll name/entry name'
. For example:
my $havePrintf = $pe->haveImportEntry('MSVCR80.dll/printf');
would set $havePrintf
true if the PE file has an import entry for the
MicroSoft C standard library version of printf.
Please report any bugs or feature requests to
bug-Win32-PEFile at rt.cpan.org
, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
This module is supported by the author through CPAN. The following links may be of assistance:
http://kishorekumar.net/pecoff_v8.1.htm
Win32::PEFile overlaps in functionality with Win32::Exe. Win32::Exe is a much more mature module and is more comprehensive. The only current (small) disadvantages of Win32::Exe are that it is not pure Perl and that has a larger dependency tree than Win32::PEFile.
For some applications a larger problem with Win32::Exe is that some file editing operations are not portable across systems.
The intent is that Win32::PEFile will remain pure Perl and low dependency. Over time PEFile will acquire various editing functions and will remain both cross- platform and endien agnostic.
Thank you Engin Bulanik for contributing the seed code for getVersionCount().
Peter Jaquiery CPAN ID: GRANDPA grandpa@cpan.org
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
Win32::PEFile - Portable Executable File parser |