Project Description
Interceptor is an open source library used to intercept managed methods. The library can be used whenever an hook of a managed method is necessary.
Currently Interceptor works only on 32 bit machine.
Example of interception:
public static void Main()
{
var hook = MethodHookFactory.Create();
var sayHelloMethod = typeof( Program ).GetMethod( "SayHello" );
var sayGoodbyeMethod = typeof( Program ).GetMethod( "SayGoodbye" );
hook.Initialize( sayHelloMethod, sayGoodbyeMethod );
hook.Hook();
Console.WriteLine( Program.SayHello() ); // print "Goodbye"
hook.UnHook();
Console.WriteLine( Program.SayHello() ); // print "Hello"
}
public static String SayHello()
{
return "Hello";
}
public static String SayGoodbye()
{
return "Goodbye";
}
Read more: Codeplex