5

I have an existing application that is closed-source and ships its own version of Mono 3.5. I want to change the behavior of the application; specifically, I want to swap out a built-in class with a new one.

Normally, one goes about this with Mono.Cecil. However, in my case the application assembly is loaded from a readonly volume which makes modifying the assembly itself very very tricky (it involves hardware hacks to produce a new volume). I can, however, get it to load an arbitrary DLL via an officially-supported mechanism, which I could in theory use to modify the assembly at runtime.

There are numerous resources for achieving runtime code injection / function hooking via the .NET Framework, but they all fail under Mono. Approaches I've seen include:

See related questions:

I am aware that this is a pretty terrible plan. However since I don't have the sourcecode and modifying the assembly on disk is even more terrible than doing some kind of dirty runtime hack, this is the best alternative I've generated so far.

Community
  • 1
  • 1
Drew
  • 7,637
  • 5
  • 38
  • 40
  • Have you thought about plain old hot patching the actual machine code? You'd have to find out the address of the compiled method (at least mono shouldn't replace it while running) which probably isn't any easier but it may be worth a try. – Voo Jul 21 '14 at 20:18

0 Answers0