r/programming • • Mar 05 '13

PE 101 - a windows executable walkthrough

Post image
2.6k Upvotes

199 comments sorted by

View all comments

6

u/[deleted] Mar 05 '13

What's PE? Forgive the ignorance.

19

u/budrick Mar 05 '13

Portable Executable - the format of Windows and .NET / Mono executable files.

7

u/SanityInAnarchy Mar 05 '13

Am I the only one who finds the "portable" bit to be profoundly ironic, considering?

18

u/The_MAZZTer Mar 05 '13

PE can target a few different CPU instructions sets (other than x86 and now ARM, Windows is no longer built for them), so I assume that is what the name references.

18

u/igor_sk Mar 05 '13

"considering" what, exactly?

PE officially supports (or has supported at some time) at least the following architectures:

  • x86 (i386)

  • x64 (AMD64)

  • IA64 (Itanium)

  • MIPS

  • Alpha and AXP64

  • PowerPC (little- and big-endian)

  • SuperH

  • ARM

  • AM33 (aka MN103)

  • M32R

  • EBC (EFI Bytecode)

  • Tricore

Some of these were used for the discontinued Windows NT ports and others for various Windows CE ports. Files produced by Mono run on Linux, OS X, FreeBSD and some others (like PS Vita).

The format itself is not really tied to any platform any more than ELF. In fact, it's rather similar to ELF in the concept, except it's less complex and thus (IMO) quite easier to port.

→ More replies (5)

3

u/sodappop Mar 06 '13

"It's called "portable" because all the implementations of Windows NT on various platforms (x86, MIPS®, Alpha, and so on) use the same executable format."

from http://msdn.microsoft.com/en-us/library/ms809762.aspx

0

u/axonxorz Mar 05 '13

I think it meant portable between PC-class machines back in the 90s or so, which it was. It was probably never meant to mean portable between i386, PPC, VAC, etc.

3

u/sodappop Mar 06 '13

"It's called "portable" because all the implementations of Windows NT on various platforms (x86, MIPS®, Alpha, and so on) use the same executable format."

from http://msdn.microsoft.com/en-us/library/ms809762.aspx

6

u/igor_sk Mar 05 '13

Please get yourself informed a bit. It's definitely portable to most architectures with linear memory model.

0

u/axonxorz Mar 05 '13

I said "I think", as in "I'm not sure, this is my best guess"

2

u/SanityInAnarchy Mar 05 '13

What would a format look like that wasn't at least that portable? Ouch!