
Hello everyone! I have a rather challenging question, that perhaps can be resolved without too much dark magic. A little background: I'm patching an executable (x86 platform, but could be easily extended to other architectures). players: void TargetFunc(some parameters); void Hook(some parameters); method: Grab first 5 bytes of TargetFunc. Back them up. Replace them with a jmp Hook. Make Hook finish as follows: Restore the backup of 5 bytes. Call TargetFunc again, this time the real one, not the jmp. Replace the 5 bytes with jmp Hook, getting ready for the next invocation. In a nutshell - typical trampoline. Now, I want to write a framework for this. I would prefer to be able to have some code reuse. Can either mem_fn or bind be helpful here? I'm trying to understand how they work. I feel like they are creating extra 'functions' with some game about parameters. Ideas? cheers, Tomasz