Thoughts on writing an IL disassembler .ver 0:1:0:0

by Jason Haley 7. August 2005 18:57

The past month or so I have been working on writing an IL disassembler that reads the bytes of a file according to the Ecma spec and makes some sense of it.  Currently the top 4 most valuable resource for me are:

  1. The Partition II document
  2. Serge Lindin's Inside Microsoft .Net IL Assembler
  3. Vijay Muki's “The IL Disassembler“
  4. Petreny Zsolt's Dotnet IL Editor project

Vijay (code name for the project) now reads in a .Net file and fills data structures for the main parts of an assembly (PE Headers, Clr Headers, Metadata streams and all the Metadata tables).  So far the biggest challenge has been getting the time to work on it.

Below is an example of what it is outputing right now (for the metadata tables).  This week, the output will start to take shape and look more like what  you are use to seeing from ILDasm (except the IL code, that will be next week or the week after).

Module Table has 1 rows:
---------------------------------------------------------------
Generation: 0x0
Name: 0xa
Mvid: 0x1
EncId: 0x0
EncBaseId: 0x0

TypeRef Table has 2 rows:
---------------------------------------------------------------
Resolution Scope: 0x6
Name: 0x42
Namespace: 0x2f

Resolution Scope: 0x6
Name: 0x6f
Namespace: 0x68

TypeDef Table has 2 rows:
---------------------------------------------------------------
Flags: 0x00000000
Name: 0x1
Namespace: 0x0
Extends: 0x0
FieldList: 0x1

Flags: 0x00100001
Name: 0x76
Namespace: 0x0
Extends: 0x9
FieldList: 0x1

Method Table has 2 rows:
---------------------------------------------------------------
Rva: 0x2050
ImplFlags: 0x0000
Flags: 0x0096
Name: 0x7a
ParamList: 0x1

Rva: 0x2060
ImplFlags: 0x0000
Flags: 0x1886
Name: 0x56
ParamList: 0x1

MemberRef Table has 2 rows:
---------------------------------------------------------------
Class: 0x9
Name: 0x56
Signature: 0x1f

Class: 0x11
Name: 0x56
Signature: 0x29

CustomAttribute Table has 1 rows:
---------------------------------------------------------------
Parent: 0x2e
Type: 0xb
Value: 0x2d

Assembly Table has 1 rows:
---------------------------------------------------------------
HashAlgId: 0x00008004
MajorVersion: 0x0
MinorVersion: 0x0
BuildNumber: 0x0
RevisionNumber: 0x0
Flags: 0x00000000
PublicKey: 0x0
Name: 0x7f
Culture: 0x0

AssemblyRef Table has 1 rows:
---------------------------------------------------------------
MajorVersion: 0x1
MinorVersion: 0x0
BuildNumber: 0x1388
RevisionNumber: 0x0
Flags: 0x00000000
PublicKeyOrToken: 0x1
Name: 0x26
Culture: 0x0
HashValue: 0xa

File Table has 1 rows:
---------------------------------------------------------------
Flags: 0x00000000
Name: 0x15
HashValue: 0x34

ExportedType Table has 2 rows:
---------------------------------------------------------------
Flags: 0x00100001
TypeDefId: 0x2
TypeName: 0x200
TypeNamespace: 0x5c
Implementation: 0x0

Flags: 0x00010004
TypeDefId: 0x10
TypeName: 0x3
TypeNamespace: 0x200
Implementation: 0x60

 

Comments (0) | Post RSSRSS comment feed |

Categories:
Tags:

Comments are closed