Karthikeyan
Karthikeyan

Reputation: 373

Difference between .exe and .pe files?

When compiling visual studio c# applications PE and EXE files will generate. So what main difference between PE and EXE file? As i know PE file contains

PE/COFF Headers,
CLR Headers,
CLR Data,
Meta Data,
IL code,
.data,.text...

than what exe contains?.How PE differ from EXE?

Upvotes: 5

Views: 7369

Answers (3)

Daniel
Daniel

Reputation: 28074

.exe files are a subset of PE files, while PE files include .exe, .dll and .ocx files.

Upvotes: 3

gustavodidomenico
gustavodidomenico

Reputation: 4681

So, PEstands for Portable Executable which is the file format for executable binaries in Windows 32bits and 64bits environments.

In my understanding, the information inside the generated PEfile would consist in:

  • Headers
  • Metadadata
  • CLR Data segments

However, the IL Code would be inside the EXE file, since it is supposed to be platform independent and it will be compiled to native code when you run the application (Just-in time-compiler). The PEsection is also in charge of the initialisation of the CLR.

Keep in mind the PE section can be inside the executable file, which make more sense in most applications.

Upvotes: 2

Matias Cicero
Matias Cicero

Reputation: 26281

Portable Executables (PE) are files that contain all the necessary information for the operating system to correctly load executable code (.exe, .dll, ...)

This may include dynamic library references for linking, resource management, TLS data, among other things.

Executables (.exe), however, are the files that denote the main execution point on a computer program, that is, speaking in C# terms, the file that contains the Main function or entry point.

Upvotes: 8

Related Questions