アセンブリ内容の操作と、C#/VBによるコードインジェクション

Assembly Manipulation and C#/VB.NET Code Injection
http://www.codeproject.com/KB/msil/reflexil.aspx


Reflexil is an assembly editor and runs as a plug-in for Lutz Roeder's Reflector. Reflexil is able to manipulate IL code and save the modified assemblies to disk. Reflexil also supports "on-the-fly" C#/VB.NET code injection.

Reflexilは、Lutz Roeder's Reflectorのプラグインとして動作するアセンブリエディタです。Reflexilによって、ILコードを編集し、変更されたアセンブリをディスクに保存することが可能となります。また、C#/VB.NETによるオン・ザ・フライでのコードインジェクションをおこなうことも可能です。



Reflector is a great tool for doing an in-depth examination of various types of assemblies and also for disassembling IL code towards a supported .NET language. However, Reflector is unable to modify either the structure or the IL code of assemblies. Reflexil allows such modifications by using the powerful Mono.Cecil library written by Jb EVAIN. Reflexil runs as a plug-in and is directed especially towards IL code handling. It accomplishes this by proposing a complete instruction editor and by allowing C#/VB.NET code injection, as we will see in the following two examples.

Reflectorは、さまざまなタイプのアセンブリの詳細な分析や、ILコードの.NET言語への逆アセンブリなどをおこなうことのできる素晴らしいツールです。しかし、アセンブリの構造やILコードを修正することはできません。Reflexilは、Jb EVAIN氏のパワフルなMono.Cecilライブラリを使用し、このような修正を可能としています。Reflexilは、プラグインとして動作しILコードのハンドリングを担当します。この機能は、後述の2つの例のように、インストラクションエディタとC#/VB.NETによるコードインジェクションによって実現されます。