Sunday, June 28, 2009

Portable executable(PE)



Portable executable(PE) is a dll or exe file created after the compilation.

Compiling source code architecture for C# is as Shown in figure



When you write the code and compiles the code the compiler(in the second block) check the syntax and produce a managed module(PE)


Parts Of PE

PE has mainly four parts

  1. PE Header : indicates the type of file (GUI or .dll) and it also contains time of the file created.Also contains the information of the native CPU code.
  2. CLR Header: Contains the information of version of managed module(PE),some flags,metadata ,the size of the metadata,strong name etc.
  3. Metadata: contains two tables,one contains types(eg:class used) and members defined in the source code and the second table contains members and types reffered by the source code)
  4. Intermediate Source Code(IL) : Compiler produce the compiled source code.the CLR then compiles the IL to native CPU instructions.
If you want to see the PE data.intermediate language deassembler(ILDASM) helps you to open the PE.

Open the visual studio command prompt and type ildasm and the PE(.dll or exe)will open the IL DASM from the open you can locate the PE and see how your PE is.





But you cant able to open the win32 dlls because it doesnot contain the CLR header and it is not created in this manner.so you cannot able to open it

If you have any dought in this mail me :anishmarokey@gmail.com

0 comments:

 
Counter