hooking C++ methods

c++ / delphi package - dll injection and api hooking

hooking C++ methods

Postby dgmax » Fri Aug 18, 2017 8:37 pm

Hello,

I have been playing with MadCodeHook trying to hook methods in a C++ class in a 32 bit application.
In 32 bits, the usual "__thiscall" calling convention will require handcrafted assembly to recover the "this" pointer passed by ecx and pass it on to the "next hook".
I can declare the handler/nexthook as class members and follow the technique shown here viewtopic.php?t=66.
I am curious if this is still the recommended way, or if the library has changed since then and you recommend a different method.

Thanks,
dgmax
dgmax
 
Posts: 3
Joined: Wed Jul 12, 2017 6:49 pm

Re: hooking C++ methods

Postby madshi » Mon Aug 21, 2017 1:58 pm

I'm not sure. Maybe you can do something with "__thiscall"? I never really had the need to hook a C++ class, yet, so I didn't really try myself. I did hook some interfaces, like Direct3D, but they're WINAPI/stdcall, which makes things a lot easier.
madshi
Site Admin
 
Posts: 9384
Joined: Sun Mar 21, 2004 5:25 pm


Return to madCodeHook

Who is online

Users browsing this forum: No registered users and 2 guests

cron