Requirement
1. Double-click the form to pop up the Untitled messageBox.
Source code
Using System;
Using System. Windows. Forms;
Namespace ReflexilDemo
{
Public class DemoForm: Form
{
Public DemoForm ()
{
// InitializeComponent ();
This. Click + = DisplayResultButton_Click;
}
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)
{
Decimal a = 3.0 M;
Decimal B = 6.0 M;
ComputeAndDisplay (a, B );
}
Static void Main ()
{
DemoForm df = new DemoForm ();
Df. ShowDialog ();
Console. Read ();
}
}
}
2. After the code is injected, double-click the form and a title messageBox will pop up.
Implementation
Use. NET ReflectorAnd Reflexil, Modify ilCode implementation.
The source code shows that messageboxInComputeAndDisplay method, so we need to modify the il of this method.
Steps:
LUse ReflexilOpenComputeAndDisplay
LInsert string
LModify MessageBox. Show(String)----À MessageBox. Show (string, string)
LSelect Show (string, string ),Double-click
L then save the modified result
L run again