The Most Important File Format

Post on 07-Aug-2015

431 views 1 download

Tags:

Transcript of The Most Important File Format

Jb Evain@jbevain

Visual StudioPlatform Team

Mono contributor

Visual Studio Tools for Unity

The most important file format…

… for .NET developers

You consume it

You produce it

A binary format

the .NET assembly

.NET assembly

=

Windows executable

Why should you care

¯\_(ツ)_/¯

Chapter 1The data

PE fileHEADERS

SECTION

SECTION

.NET metadataHEADERS

Strings

Types MethodsFields Parameters …

Blobs GuidsHeaps

Tables

.NET metadatavoid Foo::Bar(int i)

Strings

FooBar

i

Type

#1

Method

#1

Parameter

#1

Blobs

instance void(int)Heaps

Tables

.NET IL

Tables

Heaps

IL

Chapter 2The tools

using System.Reflection;

Not great for

Reading assemblies as data Reading IL code Modifying assemblies

1. IKVM.Reflection

Great for

Creating new assemblies Porting System.Reflection code

2. System.Reflection.Metadata

Great for

Reading metadata (very) quickly

3. Mono.Cecil

Great for

Analyzing assemblies Modifying assemblies

Thank you!

@jbevain