sourcehook/sourcehook_hookmangen.h
branchhookman_autogen
changeset 455 deec66cea8cc
parent 449 78c6dfc7fff5
child 456 9f19985c76aa
     1.1 --- a/sourcehook/sourcehook_hookmangen.h	Fri Nov 09 21:14:37 2007 +0000
     1.2 +++ b/sourcehook/sourcehook_hookmangen.h	Sat Nov 10 16:10:55 2007 +0000
     1.3 @@ -11,7 +11,6 @@
     1.4  #ifndef __SOURCEHOOK_HOOKMANGEN_H__
     1.5  #define __SOURCEHOOK_HOOKMANGEN_H__
     1.6  
     1.7 -#include "sourcehook_impl.h"
     1.8  #include "sh_pagealloc.h"
     1.9  
    1.10  namespace SourceHook
    1.11 @@ -158,6 +157,8 @@
    1.12  			const static int SIZE_PTR = sizeof(void*);
    1.13  			const static int PassFlag_ForcedByRef = (1<<30);   // ByVal in source, but actually passed by reference (GCC) -> private pass, destruct
    1.14  
    1.15 +			HookManagerPubFunc m_GeneratedPubFunc;
    1.16 +
    1.17  			CProto m_Proto;
    1.18  			int m_VtblOffs;
    1.19  			int m_VtblIdx;
    1.20 @@ -231,13 +232,40 @@
    1.21  			void BuildProtoInfo();
    1.22  			void *GenerateHookFunc();
    1.23  			void *GeneratePubFunc();
    1.24 +			
    1.25 +			HookManagerPubFunc Generate();
    1.26  		public:
    1.27  			// Level 1 -> Public interface
    1.28  			GenContext(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx, ISourceHook *pSHPtr);
    1.29  			~GenContext();
    1.30  
    1.31 -			HookManagerPubFunc Generate();
    1.32 +			bool Equal(const CProto &proto, int vtbl_offs, int vtbl_idx);
    1.33 +			bool Equal(HookManagerPubFunc other);
    1.34 +
    1.35 +			HookManagerPubFunc GetPubFunc();
    1.36  		};
    1.37 +
    1.38 +		class CHookManagerAutoGen : public IHookManagerAutoGen 
    1.39 +		{
    1.40 +			struct StoredContext
    1.41 +			{
    1.42 +				int m_RefCnt;
    1.43 +				GenContext *m_GenContext;
    1.44 +			};
    1.45 +			List<StoredContext> m_Contexts;
    1.46 +			ISourceHook *m_pSHPtr;
    1.47 +
    1.48 +		public:
    1.49 +			CHookManagerAutoGen(ISourceHook *pSHPtr);
    1.50 +			~CHookManagerAutoGen();
    1.51 +
    1.52 +			int GetIfaceVersion();
    1.53 +			int GetImplVersion();
    1.54 +
    1.55 +			HookManagerPubFunc MakeHookMan(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx);
    1.56 +			void ReleaseHookMan(HookManagerPubFunc pubFunc);
    1.57 +		};
    1.58 +
    1.59  	}
    1.60  }
    1.61