![]() |
C++ Help (Hooking a function)
Say i have the sdk of a application with such a function defined.
Code:
void Check_Registration (Code:
typedef void (*NotifyOnlineOrig)(DATE *,int);Code:
void NotifyOnlineNew ( DATE *pDate, int ChkSum)Code:
void Check_Registration (Thanks :) |
I may be wrong, but:
Callback_NotifyOnline passed by *, not **, so you can't modify it, if it would be ** you could do *Callback_NotifyOnline=NotifyOnlineNew |
Is it the library that calls Check_Registration (to be filled by you)? Or is Check_Registration part of the library and should be called by your application code?
|
Check_Registration is part of the application a function, and is being replaced hooked by me, so now i can use that function, so inside it i want to hook the callback one, but whatever i try doesnt seem to work for it.
Sergey Nameless: thanks it works for the latter but not filling the original part so i will have no way to call the original. |
A typedef problem, maybe...
Hi
When you write Code:
typedef void (*NotifyOnlineOrig)(DATE *,int);You may try something like Code:
typedef void (*t_NotifyOnlineOrig)(DATE *,int);Have a nice day Tuba |
I think you can but...
If I understand, you want to hook the call of Check_Registration done by another ?
Check_Registration use a function pointer to a callback_function. So, inside its body, you have a call like : Callback_NotifyOnline ( , ); If this API is in a DLL (like its_SDK.dll) and if you want to hook this call : 1. you need to export the same API in your library (my_SDK.DLL) with the same protoype 2. call the old API inside your API (export OR LoadLibrary, GetProcAddress) 3. rename my_SDK to its_SDK and its_SDD to Original_SDK If this API isn't in a DLL ie resolved by compiler, you have the source so you can do anything ! |
Yea like that, but i already have hooked Check_Registration, and inside the sdk they can use like you said: Callback_NotifyOnline();
now i want to hook also Callback_NotifyOnline();, but looking thru the sdk, its not defined nowhere except in the routine its self here: Code:
void Check_Registration ( |
Is the function exported? If not you may have to find the address your self, by searching for certain fragments or memory or using the exact address/offset of it (how ever this can fail if the file gets changed)
|
Solved! thanks, it was a combination of the multiple post here:
i ended up doing: Code:
Info Code: |
| All times are GMT +8. The time now is 14:27. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX