Nested calls

c++ / delphi package - dll injection and api hooking
Post Reply
x_art
Posts: 20
Joined: Wed Jan 27, 2010 9:26 am

Nested calls

Post by x_art »

For example, I'm hooking two functions (funcA and funcB) in two different modules. Originally, funcA internally calls funcB. Will be my hook for funcB called when I'm in the hook for funcA and executing nextFuncA?

Hope, my description is clear :)
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Nested calls

Post by madshi »

Yes, it will work just fine. madCodeHook has a fully automatic hook queue. Calling "nextFuncA" always automatically calls the next hook in the chain. Only the last call to "nextFuncA" in the hook chain will call the original function.
x_art
Posts: 20
Joined: Wed Jan 27, 2010 9:26 am

Re: Nested calls

Post by x_art »

I'm monitoring API calls with "API monitor". I shows that funcA calls funcB. This is ok and expected. When I close "API monitor" and start my application and funcA calls funcB, then my hook is executed for funcA only.
If funcB will be called outside funcA, then a hook for funcB will be executed without any problems.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Nested calls

Post by madshi »

Show me your code, please.
x_art
Posts: 20
Joined: Wed Jan 27, 2010 9:26 am

Re: Nested calls

Post by x_art »

Sorry, this is my mistake. Two modules export identical function. I've got mixed up with it.
Post Reply