Source Code How to hook thiscall function - __thiscall calling convention

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat


Meme Tier VIP
Aug 19, 2012
Yo, it might be good for some to know about hooking a thiscall clean.

Lets say the func looks like this in ida or whatever (postrender ue3)
int __thiscall sub_11A8B30(_DWORD *this, int a2, void *Dst)
then you setup the prototype as common
typedef void(__thiscall  *tPostRender)(DWORD*, int, void*);
tPostRender oPostRender;
and here it gets important, the actual function will be a fastcall.
first param is "this", second just a unsused register param, and then the normal params again
void __fastcall hkPostRender(DWORD* _this, void* _notUsed, int _a2, void* _Dst)

 //but called as the original prototype here !
oPostRender(_this, _a2, _Dst);

I wont add detour/minhook etc code here, because it can be found in other threads.

Credits go to tresp4sser for his blog with some good infos

Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods