Patching .net executables with Reflexil.

Lost the source code of a .net executable file? What will you do? Instead of searching for the missing piece which was not documented and not hosted in the version control, instead of searching for it in windows explorers for hours when you already know it cant be found, instead of blaming someone for not making a backup of it, go move and use a tool from red gate called the reflector and its add-in called reflexil.

My case was like the above, where someone forgot to make a backup of a running program, which will run forever. Its a windows application where members of a certain promotion are going to swipe their cards to the application and if they are entitled, the standalone application will print a voucher stating that they can claim these and those. The application needs to be updated by certain people monthly, and my boss asked me if there is a way to automate it? I said YES, but the problem is i dont have the source code, only the executable. I said, there has to be a way, and here is how I did it.

First, download these tools:
1. Reflector – http://www.red-gate.com/products/reflector/
2. Reflexil – http://sebastien.lebreton.free.fr/reflexil/

Lets setup reflector first.
1. Open reflector.

2. Add reflexil in the add-ins. Just go to View->AddIns and add Reflexil.Reflector.dll.

3.  Load the executable file that you need to patch.

4. Now select the function or method that you want to patch. Right-click on the reflexil pane and select Replace all with code.

5. Now lets make our changes.

Once you did the change, Right-click your loaded assembly and select save as from the context menu.

Now see the lesson? “Next time, host your code in your version control!.”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: