understanding msil l.
Skip this Video
Loading SlideShow in 5 Seconds..
Understanding MSIL PowerPoint Presentation
Download Presentation
Understanding MSIL

Loading in 2 Seconds...

play fullscreen
1 / 16

Understanding MSIL - PowerPoint PPT Presentation

  • Uploaded on

Understanding MSIL. By Sam Nasr September 28, 2004. Objectives. Learn MSIL terminology Understand sections of an Assembly Discuss IL Tools Discuss additional resources. Advantages of Understanding MSIL. Better understanding=Better troubleshooting.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Understanding MSIL' - lotus

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
understanding msil

Understanding MSIL


Sam Nasr

September 28, 2004

  • Learn MSIL terminology
  • Understand sections of an Assembly
  • Discuss IL Tools
  • Discuss additional resources
advantages of understanding msil
Advantages of Understanding MSIL
  • Better understanding=Better troubleshooting.
  • Understanding of possible security vulnerabilities.
  • “All roads lead to CLR”
  • CLR: Common Language Runtime
  • Assembly: Managed .Net application.

Each assembly contains minimum 1 prime module, but possibly other additional modules.

  • Module: Managed executable
  • Metadata: Data descriptors (i.e. info that describes the data).
  • MSIL: Microsoft Intermediate Language
  • ILDASM: Intermediate Language Disassembler.

Compiling in a .Net Framework

(IL, similar to JVM)


Compiling in a traditional environment

(native executable code)

execution in net
Execution in .Net
  • .Net Applications (assemblies) consist of one or more managed executables, each carrying metadata and managed code.
  • “JIT” Compiler compiles IL to machine code dynamically as needed.
  • Objects are loaded only when used.
  • Machine code compilations are cached for subsequent executions.
execution in net8
Execution in .Net
  • Code is executed in “Managed Environment” (type control, garbage collection, exception handling).
  • Can compile from IL to native machine code using NGEN utility.
  • Cost of Code: (Sizes of “Hello World” .exe)

C#(3K) VS. C(32K) VS. C++(173K)

clr requirements
CLR Requirements

The CLR requires the following information about

each method, which is available through metadata.

  • Instructions: each method has a pointer to the instruction set.
  • Signature: describes the calling convention, return type, parameter count and type
clr requirements10
CLR Requirements
  • Exception Handling Array: a list of exceptions and the offset address to the handling code.
  • Evaluation Stack Size: typically seen as .maxstack in the ILDASM listing.
  • Locals Array: all local variables used.
  • Create a program in Visual Studio.Net
  • Debug and compile.
  • Use ILDASM to generate .IL file.
  • Use file editor to edit .IL file.
  • Use ILASM to create the new assembly.
reading il
Reading IL
  • RVA: Relative Virtual Address
  • ldstr: loads a string token
  • .assembly extern: defines an external application referenced in the existing program.
  • .module: defines the current module.
  • .field: defines a metadata item used in the module
reading il13
Reading IL
  • .method: defines a member method of the given class.
  • .entrypoint: defines the entry point of the current method
  • .locals init: defines the single local variable of the current method.
msil utilities
MSIL Utilities
  • ildasm.exe: Converts IL to human readable code

C:\Program Files\Microsoft Visual Studio.NET\ FrameworkSDK\Bin

  • dumpbin.exe: Converts IL to human readable code

C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin

  • Reflector.exe: Converts IL to human readable code


  • ILASM.EXE: Converts human readable code to IL


  • NGEN.exe: Compiles IL to machine code.


  • Inside Microsoft .NET IL Assembler by Serge Lidin
  • .NET Common Language Runtime Unleashed by Kevin Burton


  • Assemblies Ins and Outs by Chris Rausch (http://www.vbdotnetheaven.com)
  • DotFuscator