View Single Post
  #1  
Old 08-30-2004, 18:44
Peter[Pan]
 
Posts: n/a
C++ Help (Hooking a function)

Say i have the sdk of a application with such a function defined.

Code:
void Check_Registration (
int Registered,
int Licenses,
int LicenseType,
int ChkSum,
int RESERVEDA,
int ( *Callback_CheckDate )( DATE *pDATE ),
void ( *Callback_NotifyOnline)( DATE *pDate, int ChkSum ) )
{

}
Now, i want to hook the NotifyOnline with my own function so i define.

Code:
typedef void (*NotifyOnlineOrig)(DATE *,int);
and my function:
Code:
void NotifyOnlineNew ( DATE *pDate, int ChkSum)
{
     NotifyOnlineOrig(pDate,ChkSum);
}
and try this inside the function.
Code:
void Check_Registration (
int Registered,
int Licenses,
int LicenseType,
int ChkSum,
int RESERVEDA,
int ( *Callback_CheckDate )( DATE *pDATE ),
void ( *Callback_NotifyOnline)( DATE *pDate, int ChkSum ) )
{
   NotifyOnlineOrig=Callback_NotifyOnline;
   Callback_NotifyOnline=NotifyOnlineNew;
}
of course the = parts dont work, how can i achive this, (its not a real sdk, so plz dont ask)

Thanks
Reply With Quote