Link to home
Start Free TrialLog in
Avatar of SpringMVC
SpringMVC

asked on

Need to modify C# compiled dll

Hi!

I have compiled C# dll. And I need to modify one method inside this dll.
The methods looks like:
void func()
{
    MessageBox.Show("Text of message box", "Title", MessageBoxButton.OK, MessageBoxImage.Exclamation);
}
I need to add "return" statement, before MessageBox.
I have installed Olly Debugger, moreover I did search in "Memory dump" window for "Text of message box" and I have found some places(addresses), where this text occurs, but I don't know how to modify(insert return statement) dll in these places using Olly Debugger(is this possible?).
By the way, I know exact method's name, text and so on.(Actually, I do have source code, but I can not recompile this dll using source code. Please, don't ask why.)

Any articles, suggestions, software recommendations, which will help me to achieve my goal, would be highly appreciated!
ASKER CERTIFIED SOLUTION
Avatar of Avodah
Avodah
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Maybe I'm suggesting some too simple, but you can make your change on your source code, recompile and substitute old DLL with new one.

I supose that you've considered this option already and that's not viable on your situation, but hey... you never know...
Oh sorry, I've just read the end of your post, forget my previous response.

Good luck with DaTribe recommendation.
Avatar of SpringMVC
SpringMVC

ASKER

Tnx for replies.

DaTribe.
Maybe, I am wrong, but .NET Reflector - is just decompiler, since I have already source code, I don't need to use .NET Reflector, or I am wrong?
ILASM & ILDASM - Tnx, I'll look.

Bardobrave.
Ok :)
Okay my bad. I actually thought they had included the recompilation feature for .NET reflector. I seem to be getting old!

DaTribe
BTW is you have the source why not just change and recompile in VS?

DaTribe
In short, I have source code, but don't have some project satellites(resources, files aso), which are needed to recompile.
It seems a though one... if you lack on code dependencies, even if you manage to decompile the DLL you won't be able to compile it back again, because this dependencies won't be present on compilng time.

You'll need some program that allow you to directly edit the content of the compiled DLL, wich I'm not sure if it's possible at all.

As compiling is a conversion from high-level language to low-level machine code I supose that would be possible to "translate" the DLL's source code back and make changes directly on this source.

However, without an application that makes automatically the translation it could be a work as hard as hell.

I'll search for such an app when arriving home, I'll post it here if found something, but I fear that if DaTribe hasn't an ace under it's sleeve you're facing hard time...
ILDASM/ILASM
Tnx for all. I managed to change DLL using ILDASM/ILASM :)

Bardobrave
I translated .dll to .il (intermediate language) using ILDASM, changed .il file using notepad and translated back to dll from changed .il file using ILASM :)
However, tnx for your concern.
Glad to help. Those tools are the great if you like IL :)
Good to know it!

This is the best of this site, you always can learn something new and useful while trying to help someone.