{A}最新发布
您可以随时从Reflexil的最新版本。简介
。 Reflexil运行作为一个插件和IL代码的处理,特别是针对。它通过提出一个完整的指令编辑器和允许的C#/ VB.NET代码注入,这一点,我们将看到在下面的两个例子。演示应用程序
让我们用一个非常简单的应用程序,能够将两个数字相加:using System;
using System.Windows.Forms;
namespace ReflexilDemo
{
public partial class DemoForm : Form
{
public DemoForm()
{
InitializeComponent();
}
private void ComputeAndDisplay(decimal x, decimal y)
{
MessageBox.Show(String.Format("{0}+{1}={2}", x, y, x + y));
}
private void DisplayResultButton_Click(object sender, EventArgs e)
{
ComputeAndDisplay(LeftOperand.Value, RightOperand.Value);
}
}
}
{S0}
使用说明编辑器
使用指令编辑器,让我们通过调用重载方法MessageBox.Show,这需要第二个参数作为一个模态窗口显示结果的标题的更新ComputeAndDisplay方法体。为了做到这一点,我们已经初步ldstr操作码的字符串参数放在堆栈上:{S2}
{S3}
然后,我们必须更新"; callquot;指令使用的重载方法MessageBox.Show,它使用以前创建的参数:
{五}
{中六}
这是时间来保存我们的工作,并测试我们的修补程序集:{七}
我们的大会是现在使用的重载方法和合适的参数:指令编辑器功能
指令编辑器支持所有操作码中Mono.Cecil定义。支持下列操作数:基本类型:字节,sbyte,INT32,INT64,单人,双人字符串教学参考多个指令引用(转)参数或变量参考内部泛型类型参考类型,字段或方法的引用,使用浏览器,选择合适的元素。此浏览器是一样的反射之一(延迟加载,图标等)
在相当理解的方式,反射和Reflexil对象模型不同步:IL代码进行更新不会影响反射器的拆卸窗口。 Reflexil和Mono.Cecil发出的代码不执行任何检查。唯一的约束是用于一个给定的操作码的操作数的类型之间的连贯性。对于那些发现的IL操纵困难,下面的例子显示了如何用C#或VB.NET更新方法体。使用C#/ VB.NET代码注入
,您可以选择您喜欢的注入与配置的形式语言和输入/显示基地(二进制,八进制,十进制,十六进制):
让我们用quot;替换codequot所有功能对身体的ComputeAndDisplay方法:
编译窗口,让我们来查看生成的IL代码。自V0.9提供一个基本支持的intellisense /洞察:
我们可以做到这一点再次与VB.NET语言。请注意,在这个简单的例子,我们得到一个相同的IL代码(它并不总是如此):
的保存和测试我们的修补大会:C#/ VB.NET代码注入功能
代码编译在一个正确的资源释放的一个单独的AppDomain使用System.CodeDom。一旦编译,说明提取和然后重新插入原来的方法体。调整参数,变量,方法,字段和类型的引用以匹配原始的大会。代码注入是有限的:它是不可能的,到田间地头,或祖先类型中定义的方法,在原来的方法所有者类型。 V1.0以来,能够正确地注入代码的。NET 3.5编译的程序集的编译过程。方法属性编辑器
您可以轻松地更新方法签名或改变他的知名度范围。你也可以改变返回类型:
方法的参数和变量,也可编辑。 Reflexil可以加载符号(MDB和PDB文件支持),以显示原始变量的名字:类型属性编辑器
方法一样,你可以改变任何类型的能见度范围。因此,可以公开向世界的一个私人的类型:大会和大会参考编辑
组装编辑器,你可以使用一个不同的切入点,或简单地改变您的应用程序(可执行程序集转换为实例的DLL库):
您也可以更新所有信息识别:版本,公钥,名称和文化。请注意,您还可以改变任何引用的程序集,所以你可以使用不同的版本:异常处理
Reflexil允许添加/更新/删除相关的异常处理程序与方法体。支持以下类型:捕获过滤器(VB.NET凡在try / catch块子句)最后
故障
签名的程序集支持
生成的程序集签名的程序集保存时,是摆在quot;延迟signedquot;状态。 Reflexil可以使用SDK工具来修复它。
V0.7以来,Reflexil能够消除集的强名称和更新引用的程序集。您也可以自己做组装编辑器:去除公共密钥和HasPublicKey标志设置为false。结论
Reflexil完全基于Mono.Cecil。有趣的是,Mono.Cecil负载运行时的帮助,没有集会,因此,有没有资源释放的约束,例如AppDomain的隔离。没有的System.Type和Mono.Cecil.TypeDefinition之间的关系,而他们都实现。NET类型的概念。如果我们想以编程方式重现我们的第一个例子(显示过载),我们可以编写以下代码,感谢Mono.Cecil:{C}更改日志
历史19日,2007年9月 - 文章发布2007年10月,22 - 完整的源代码下载添加到文章六月十三日,2008年 - V0.6,V0.7,V0.8升级2009年1月,29日 - V0.9升级2009年10月,23日 - V1.0升级
////////////////////////////////////////////////////////////////////////////////
// v1.0 - 23/10/2009 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- proper configuration for code injection with .NET 3.5 compiled files
- using up to date Mono.Cecil.Pdb (now fully managed)
bugfixes:
- fixed ArgumentOutOfRange with some compile errors (replace all with code)
- fixed error CS0006: Metadata file '...' could not be found
////////////////////////////////////////////////////////////////////////////////
// v0.9.1 - 30/04/2009 /////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- check if .NET Framework v3.5 is installed
bugfixes:
- some debug code was left, causing errors to users without "c:" drive.
misc:
- source code cleanup
////////////////////////////////////////////////////////////////////////////////
// v0.9 - 28/01/2009 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- instruction offset column
- code editor intellisense
- region folding
- insight window
bugfixes:
- assembly browser was only listening to mouse events
- fix combobox rendering errors without visual themes
misc:
- source code cleanup
////////////////////////////////////////////////////////////////////////////////
// v0.8 - 25/05/2008 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- assembly reference editor (name, version, public key, token, hash)
- assembly name editor (entry point, assembly kind, framework version, name,
version, public key, token)
upgrades:
- 'unsafe' code generation support
- reflector item handler
bugfixes:
- field reference fix after code injection
- forms tabindexes
////////////////////////////////////////////////////////////////////////////////
// v0.7 - 17/01/2008 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- type attributes editor (sealed, semantic, layout, string format,
visibility, ...)
- strong name remover
upgrades:
- sn.exe registry keys with framework 3.5
- C# / VB.NET code generator
bugfixes:
- static field code generation
- VB.NET 'Single' type alias code generation
- C# / VB.NET keywords used as field/method/parameter names
- main window flicker fix
////////////////////////////////////////////////////////////////////////////////
// v0.6 - 30/10/2007 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- symbol loading support (pdb and mdb)
- method attributes editor (member access, vtable layout, code type,
management, calling convention, return type) -> so you can change a method
visibility
- parameter editor -> so you can change a method signature
- variable editor
upgrades:
- multiple selection support in grids
- method RVA tooltip in grids
- assembly / method definition cache system
bugfixes:
- namespaces with type browser
- pointer type matching
- method matching
- generic type matching
- remoting timeout with compilation window
- Mono.Cecil import context update
- VB.NET arrays
- unsafe C# compilation setting
- prevent "insert after/insert before" when a list is empty
////////////////////////////////////////////////////////////////////////////////
// v0.5 - 14/09/2007 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- VB.NET code injection
- binary, octal, hexadecimal, decimal base support.
- configuration form
upgrades:
- code injection is no more 'context-free': type, fields and methods can
be referenced, and are automatically mapped to original items.
- scroll positions are now saved when creating/updating/deleting
instructions or exception handlers
bugfixes:
- injection code works even if the library is not in the same folder than
Reflector.
- sn.exe (strong name utility) is correctly located even if PATH variable
contains quotes.
////////////////////////////////////////////////////////////////////////////////
// v0.4 - 29/08/2007 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- exception handlers support.
- exception handler drag&drop.
- signed assembly support.
upgrades:
- Reflector bug report is sent to reflexil mailbox.
bugfixes:
- using non CLI images with Reflector.
////////////////////////////////////////////////////////////////////////////////
// v0.3 - 20/07/2007 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- instruction drag&drop.
- delete all instructions.
- C# code injection (preliminary support).
upgrades:
- opcodes autocomplete.
////////////////////////////////////////////////////////////////////////////////
// v0.2 - 08/07/2007 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
news:
- editors: type, method or field references.
upgrades:
- instruction edit form with opcodes descriptions (and grid tooltips).
////////////////////////////////////////////////////////////////////////////////
// v0.1 - 02/07/2007 ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////