Raised This Month: $ Target: $400
 0% 

[TUT] Most Efficient Function Hooking Method


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
jim_yang
Veteran Member
Join Date: Aug 2006
Old 09-04-2010 , 04:36   Re: [TUT] Most Efficient Function Hooking Method
Reply With Quote #2

A example that using this method to hook when a player timed out or dropped while he's trying to connect to server
console print like this:
Code:
PlayerA timed out
PlayerB dropped
here is the function in swds.dll
sub_1D4EFF0("%s timed out\n", _ESI + 19720);
Code:
.text:01D9B036                 push    eax             ; Args
.text:01D9B037                 push    offset aSTimedOut ; "%s timed out\n"
.text:01D9B03C                 call    sub_1D4EFF0
the imagebase of swds.dll is
Code:
.text:01D01000 ; Imagebase   : 1D00000
so offset where need to patch is
Code:
01D9B03C + 1 - 1D00000 = 9B03D
so final code
Code:
void C_Client_TimedOut(const char *szMsg, const char *szName)
{
    here player timed out hooked
}
 
void C_Client_Dropped(const char *szMsg, const char *szName)
{
    here player dropped hooked
}
 
void Meta_Attach()
{
    //hook Client timed out
    write_func(C_Client_TimedOut, GETREALADDR(0x9B03D));
    //hook Client dropped
    write_func(C_Client_Dropped, GETREALADDR(0x9FF94));
}
Hint:
GETREALADDR is a macro I used,
gamemod = mpbase + offset
serverdll = swdsbase + offset
or you can do signature scan to get the real addr
"write_func" can found above
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>

Last edited by jim_yang; 09-08-2010 at 09:27.
jim_yang is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode