Raised This Month: $51 Target: $400
 12% 

Solved Virtual hooks, bypass only current hook


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 03-10-2020 , 10:37   Virtual hooks, bypass only current hook
Reply With Quote #1

I hook a custom virtual function in two extensions:
CBaseEntity* CreateEntityByName(const char * className);

So that control is passed to B function of extension B, then to A from extension A then back to the original CreateEntityByName. It works fine if I use RETURN_META_VALUE_MNEWPARAMS in both A and B. I get this sequence:

O -> B -> A -> CreateEntityByName -> back to O

But I need to know the result CBaseEntity pointer in both A and B. So I replace the RETURN_META_VALUE_MNEWPARAMS with:

SH_CALL and RETURN_META_VALUE(MRES_SUPERCEDE , false);

The problem here is that SH_CALL bypasses both hooks and the original CreateEntityByName is called twice, so 2 entities are created. I get this sequence:

O -> B, SH_CALL-> CreateEntityByName -> back to B -> A, SH_CALL-> CreateEntityByName -> back to A -> back to O

Is there a way to bypass only current hook to get correct sequence?

O -> B, SH_CALL-> A, SH_CALL-> CreateEntityByName -> back to A -> back to B -> back to O

Last edited by kadet.89; 03-11-2020 at 16:57.
kadet.89 is offline
Send a message via Skype™ to kadet.89
 



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 04:41.


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