Just for the fun of it, I am trying to make a simple detouring library that will detour member functions by modifying the vtable of the class to create a detour. I am getting some odd behaviour. Here is the entire program (I am using MSVC++ 2010):
fixed
It's jmp
ing to the address of the new function correctly, but it crashes after that. When I watch it in ollydbg to see why it's crashing, something very strange happens. It will walk right over some instructions without doing anything. Where I see a push xxx
in the debugger, the stack will not be modified. Where I see a retn 4
the thing will just keep going, into the space between functions, filled with int 3
s. Does anyone have any idea why this is happening?
EDIT: Nevermind, I found the answer.