immortals has asked for the wisdom of the Perl Monks concerning the following question:

Hi Everybody!
I would like to ask how can I list the contents of a PE (Portable Executable) exe file?

The result would be something like this:

Number of Sections: 4
Linker version: 1.03
Size of code: 23002
Size of Initialized Data: 34211
Address of Entry Point: 0xAE45
CPU: 80386
Object table entries: 3
Linked: Mon Mar 03 20:55:05 GMT 2003
Flags: 32 bit word machine, Local symbols stripped,
Line nunbers stripped
Linker version: 6.0
Size of code: 671744
Size of initialized data: 16384
Size of uninitialized data: 1085440
Section alignment: 4096
File alignment: 512
Size of headers: 4096
Size of image: 1777664
OS version: 4.0
Image version: 0.0
Subsystem: Windows GUI
Subsystem version: 4.0
DLL flags: 32 bit word machine, Local symbols stripped,
Line nunbers stripped
Stack reserve size: 1048576
Stack commit size: 4096
Heap reserve size: 1048576
Heap commit size: 4096

I would be very grateful, if somebody could help me.

Replies are listed 'Best First'.
Re: PE exe lister
by igelkott (Priest) on Mar 06, 2008 at 22:00 UTC
      Thanks but it displays just the version of the PE.
      I would like to get the whole information like above I mentioned it.

      Any idea?

      I have learned how to use C functions in perl, I just need some C code to easy understand, and I could use it in a perl script.
      Does anybody have something like that?

        You could try Win32::Exe which certainly seem to meet some of your requirements. However, the documentation is sparse in the extreme and the module seems to be horribly complex to achieve the little documented functionality it provides. Also, the current version fails most of it's own tests in interesting ways.

        However, it might serve as a starting point.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.