// __stdcall means that the called function must clear the arguments from the stack before return
// __cdecl is the opposite, the caller function clears the stack
// its easier to use __stdcall now
void __stdcall CChat__Draw(void* this){
}
void __declspec(naked) HOOKCChat__Draw(){
/*
.text:1000EA60 000 push 0FFFFFFFFh
.text:1000EA62 004 push offset SEH_1000EA60
.text:1000EA67 008 mov eax, large fs:0
.text:1000EA6D 008 push eax
*/
_asm {
push ecx // ecx contains the this ptr for a __thiscall, save it on stack
push ecx // push this ptr again on the stack, first parameter of CChat__Draw
call CChat__Draw
pop ecx // restore ecx register from stack
// first two instructions replaced by the jump
push 0xffffffff
mov eax,vcmpaddr // push offset +0xEA60, need to recalculate
add eax,0xBADFB
// jump back
mov eax,vcmpaddr
add eax,0xEA67 // calculate return address, third instruction
jmp eax
}
}
hook:
MakeJump(vcmpaddr+0xea60, 7, HOOKCChat__Draw);
{"text":"text","html5":"html","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"lua","bash":"sh","erlang":"erlang","go":"golang","c":"c_cpp","cpp":"c_cpp","diff":"diff","latex":"latex","sql":"sql","xml":"xml","0":"text","abap":"abap","actionscript":"actionscript","actionscript3":"actionscript","ada":"ada","apache":"apache_conf","applescript":"applescript","asm":"assembly_x86","autohotkey":"autohotkey","closure":"closure","cobol":"cobol","coffeescript":"coffee","cpp-winapi":"c_cpp","c_loadrunner":"c_cpp","c_mac":"c_cpp","c_winapi":"c_cpp","csharp":"csharp","d":"d","dart":"dart","dot":"dot","eiffel":"eiffel","fortran":"fortran","groovy":"groovy","haskell":"haskell","haxe":"haxe","ini":"ini","io":"io","java":"java","java5":"java","make":"makefile","matlab":"matlab","mysql":"mysql","objc":"objectivec","ocaml":"ocaml","pascal":"pascal","perl":"perl","perl6":"perl","postgresql":"pgsql","powershell":"powershell","prolog":"prolog","properties":"properties","rails":"ruby","rust":"rust","scala":"scala","scheme":"scheme","smarty":"smarty","tcl":"tcl","vala":"vala","vb":"vbscript","verilog":"verilog","vhdl":"vhdl","yaml":"yaml"}