Solved

Need to modify C# compiled dll

Posted on 2010-11-12
12
412 Views
Last Modified: 2012-05-10
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!
0
Comment
Question by:SpringMVC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 4
12 Comments
 
LVL 18

Accepted Solution

by:
Richard Lee earned 500 total points
ID: 34119730
What you would be looking for is .NET Reflector (you may need the pro version)
http://www.red-gate.com/products/reflector/

Also you can look into ILASM & ILDASM that come with visual studio
http://blogs.msdn.com/b/thottams/archive/2007/02/01/using-ilasm-and-ildasm.aspx

DaTribe
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34119987
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...
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34119998
Oh sorry, I've just read the end of your post, forget my previous response.

Good luck with DaTribe recommendation.
0
Is your NGFW recommended by NSS Labs?

Ours is! NSS Labs Next Generation Firewall Test gives the WatchGuard Firebox M4600 a "Recommended" rating! Curious where your NGFW landed on the  Security Value Map? See the map and download the full report today!

 

Author Comment

by:SpringMVC
ID: 34120146
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 :)
0
 
LVL 18

Expert Comment

by:Richard Lee
ID: 34120191
Okay my bad. I actually thought they had included the recompilation feature for .NET reflector. I seem to be getting old!

DaTribe
0
 
LVL 18

Expert Comment

by:Richard Lee
ID: 34120198
BTW is you have the source why not just change and recompile in VS?

DaTribe
0
 

Author Comment

by:SpringMVC
ID: 34120238
In short, I have source code, but don't have some project satellites(resources, files aso), which are needed to recompile.
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34120384
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...
0
 

Author Closing Comment

by:SpringMVC
ID: 34120736
ILDASM/ILASM
0
 

Author Comment

by:SpringMVC
ID: 34120772
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.
0
 
LVL 18

Expert Comment

by:Richard Lee
ID: 34120814
Glad to help. Those tools are the great if you like IL :)
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34121925
Good to know it!

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

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question