By Sam Nasr September 28, 2004 Understanding MSIL.

Slides:



Advertisements
Similar presentations
What is.Net Gary Devendorf. .Net Framework.Net framework works like the Domino Objects only much lower level and very complete It is part of the OS (or.
Advertisements

Ahead of Time Dynamic Translation PreJit/NGEN by any other name George Bosworth Microsoft MRE04 March 21, 2004.
Introduction to .NET Framework
.NET Framework Overview
pa 1 Porting BETA to ROTOR ROTOR Projects Presentation Day, June by Peter Andersen.
Using.NET Platform Note: Most of the material of these slides have been taken & extended from Nakov’s excellent overview for.NET framework, MSDN and wikipedia.
Building Localized Applications with Microsoft.NET Framework and Visual Studio.NET Achim Ruopp International Program Manager Microsoft Corp.
History of.Net Introduced by Microsoft Earlier technology was VC++ and VB VC++ comes with so many library and VB was so easy to use and not flexible to.
.NET IL Obfuscation Presented by: Sarath Chandra Dorbala.
Disassembling for Fun Jason Haley. Who is this guy?  Certifiable (MCSD.net certified that is)  Blog –
Debugging Production SharePoint Applications Wouter van Vugt.
.NET Framework Overview Pingping Ma Nov 16 th, 2006.
R.GOVINDARAJULU International Institute of Information Technology Hyderabad, India.. ROTOR-BASED CURRICULUM DEVELOPMENT.
Introducing the Common Language Runtime for.NET. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution.
Introducing the Common Language Runtime. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution engine.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Lecture Roger Sutton CO530 Automation Tools 5: Class Libraries and Assemblies 1.
1 Introduction to.NET Framework. 2.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET.
Introduction to .Net Framework
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Architecture of.NET Framework .NET Framework ٭ Microsoft.NET (pronounced “dot net”) is a software component that runs on the Windows operating.
Module 1: Introduction to C# Module 2: Variables and Data Types
.NET Overview. 2 Objectives Introduce.NET –overview –languages –libraries –development and execution model Examine simple C# program.
CIS NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials.
.NET Framework & C#.
Microsoft Visual Basic 2005: Reloaded Second Edition
Introduction to .NET Framework
Understanding Code Compilation and Deployment Lesson 4.
CSC 494/594 C# and ASP.NET Programming. C# 2012 C# Object-oriented language with syntax that is similar to Java.
Compiling and Executing Code in.Net Microsoft Intermediate Language and Common Language Runtime.
.NET Framework Overview
ASSEMBLIES AND THE GAC CHAPTER 1, LESSONS 4-7 & LAB.
Component-Based Software Engineering Introduction to.NET Paul Krause.
.NET Framework Danish Sami UG Lead.NetFoundry
The Web Architecture and ASP.NET. Slide 2 Review of the Web (1) It began with HTTP and HTML, which delivers static Web pages to browsers which would render.
MSIL & CLI Kun-Yuan Shieh.
1.NET FRAMEWORK CE-105 Spring 2007 Engr. Faisal ur Rehman.
AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Application Foundation Presented By : Naveed Sattar Software Engineer.
Languages and IDE (Integrated Development Environment)
tom perkins1 XML Web Services -.NET FRAMEWORK – Part 1 CHAPTER 1.1 – 1.3.
Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
MSIL C#.NET Software Development. MSIL AKA CIL What all.NET languages compile to What all.NET languages compile to Binary Intermediate Language Binary.
Microsoft .NET A platform that can be used for building and running windows and web applications such that the software is platform and device-independent.
Object Oriented Software Development 4. C# data types, objects and references.
C# and.NET. .NET Architecture  Compiling and running code that targets.NET  Advantages of Microsoft Intermediate Language (MSIL)  Value and Reference.
Wel come To Seminar On C#.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
July 22, 2001Introduction to.NET1 Introduction to.NET Framework Gholamali Semsarzadeh July 2001.
The Execution System1. 2 Introduction Managed code and managed data qualify code or data that executes in cooperation with the execution engine The execution.
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
METADATA IN.NET Presented By Sukumar Manduva. INTRODUCTION  What is Metadata ? Metadata is a binary information which contains the complete description.
Just-In-Time Compilation. Introduction Just-in-time compilation (JIT), also known as dynamic translation, is a method to improve the runtime performance.
.NET Framework.
.NET Omid Darroudi.
An Introduction to the Shared Source Common Language Infrastructure (SSCLI) Damien Watkins Copyright Watkins 2002.
Frank McCown TechLunch Old Dominion University March 28, 2007
CE-105 Spring 2007 Engr. Faisal ur Rehman
2.1. Compilers and Interpreters
.NET and .NET Core 2. .NET Runtimes Pan Wuming 2017.
CS360 Windows Programming
Chapter 1 IDE and Tools for Developing CLR-based Programs
Module 0: Introduction Chapter 2: Getting Started
Module 1: Getting Started
Introduction to C# AKEEL AHMED.
Module 10: Implementing Managed Code in the Database
Frank McCown TechLunch Old Dominion University March 28, 2007
C# and ASP.NET Programming
Presentation transcript:

By Sam Nasr September 28, 2004 Understanding MSIL

Objectives Learn MSIL terminology Learn MSIL terminology Understand sections of an Assembly Understand sections of an Assembly Discuss IL Tools Discuss IL Tools Discuss additional resources Discuss additional resources

Advantages of Understanding MSIL Better understanding=Better troubleshooting. Better understanding=Better troubleshooting. Understanding of possible security vulnerabilities. Understanding of possible security vulnerabilities. All roads lead to CLR All roads lead to CLR

Definitions CLR: Common Language Runtime CLR: Common Language Runtime Assembly: Managed.Net application. Assembly: Managed.Net application. Each assembly contains minimum 1 prime module, but possibly other additional modules. Each assembly contains minimum 1 prime module, but possibly other additional modules. Module: Managed executable Module: Managed executable

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

Background Compiling in a.Net Framework (IL, similar to JVM) VS. Compiling in a traditional environment (native executable code)

Execution in.Net.Net Applications (assemblies) consist of one or more managed executables, each carrying metadata and managed code..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. JIT Compiler compiles IL to machine code dynamically as needed. Objects are loaded only when used. Objects are loaded only when used. Machine code compilations are cached for subsequent executions. Machine code compilations are cached for subsequent executions.

Execution in.Net Code is executed in Managed Environment (type control, garbage collection, exception handling). Code is executed in Managed Environment (type control, garbage collection, exception handling). Can compile from IL to native machine code using NGEN utility. Can compile from IL to native machine code using NGEN utility. Cost of Code: (Sizes of Hello World.exe) Cost of Code: (Sizes of Hello World.exe) C#(3K) VS. C(32K) VS. C++(173K)

CLR Requirements The CLR requires the following information about each method, which is available through metadata. 1. Instructions: each method has a pointer to the instruction set. 2. Signature: describes the calling convention, return type, parameter count and type

CLR Requirements 3. Exception Handling Array: a list of exceptions and the offset address to the handling code. 4. Evaluation Stack Size: typically seen as.maxstack in the ILDASM listing. 5. Locals Array: all local variables used.

Example 1. Create a program in Visual Studio.Net 2. Debug and compile. 3. Use ILDASM to generate.IL file. 4. Use file editor to edit.IL file. 5. Use ILASM to create the new assembly.

Reading IL RVA: Relative Virtual Address RVA: Relative Virtual Address ldstr: loads a string token ldstr: loads a string token.assembly extern: defines an external application referenced in the existing program..assembly extern: defines an external application referenced in the existing program..module: defines the current module..module: defines the current module..field: defines a metadata item used in the module.field: defines a metadata item used in the module

Reading IL.method: defines a member method of the given class..method: defines a member method of the given class..entrypoint: defines the entry point of the current method.entrypoint: defines the entry point of the current method.locals init: defines the single local variable of the current method..locals init: defines the single local variable of the current method.

ILDASM Conventions

MSIL Utilities ildasm.exe: Converts IL to human readable code 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 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 Reflector.exe: Converts IL to human readable code ILASM.EXE: Converts human readable code to IL ILASM.EXE: Converts human readable code to ILC:\WINDOWS\Microsoft.NET\Framework\v NGEN.exe: Compiles IL to machine code. NGEN.exe: Compiles IL to machine code.C:\WINDOWS\Microsoft.NET\Framework\v

Resources Inside Microsoft.NET IL Assembler by Serge Lidin Inside Microsoft.NET IL Assembler by Serge Lidin.NET Common Language Runtime Unleashed by Kevin Burton.NET Common Language Runtime Unleashed by Kevin Burton ( Assemblies Ins and Outs by Chris Rausch ( Assemblies Ins and Outs by Chris Rausch ( DotFuscator DotFuscator (