Raised This Month: $ Target: $400
 0% 

Planned SourceHook changes


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 05-30-2007 , 08:14   Re: Planned SourceHook changes
Reply With Quote #10

Hello dear human being,

if I recall correctly, SH_MANUALHOOK_RECONFIGURE expects a vtable index, a vtable offset, and a this pointer offset; not a vtable pointer.

Quote:
I passed into that stuff a pointer to the vtable obtained from dlsym() and the vfunc index.
Ah, so you have a vtable pointer and an index. And you want a VP hook. In this case, I guess this is the correct way to do it:

Code:
// First, declare a manual hook
SH_DECL_MANUALHOOK*(MyHook, [your vtable index here], 0, 0 [, possibly parameters and rettype etc] );

// If you do not know the vtable index at compile-time, pass some dummy value (probably something big like 0xdeadbeef so that you get immediate crashes if you forget to set it later) to SH_DECL_MANUALHOOK and later do:
// SH_MANUALHOOK_RECONFIGURE(MyHook, [your vtable index], 0, 0);
// do NOT pass vtable pointers to SH_MANUALHOOK_RECONFIGURE !

// Then, retreive the vtable pointer, and do this:
int hookid = SH_ADD_MANUALDVPHOOK(MyHook, [your vtable pointer here], [your handler], [pre/post]);
If that gives you crashes, please post / private message the relevant parts of your code as it may be a pretty serious bug

Thank you very much,
PM

EDIT:
Ah, yes, you are right, testvphooks.cpp is only in the MSVC 7.1 project file; I won't add it to the 8.0 file because I don't have a Visual Studio version which could open such files and I'm also afraid of editing them manually. If you could send me the original 8.0 file with added testvphooks.cpp, I'd be very thankful
__________________
hello, i am pm

Last edited by PM; 05-30-2007 at 09:16.
PM 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 07:20.


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