sourcehook/sourcehook_impl.h
changeset 58 71016f952503
parent 42 390a2aec00e4
child 86 0c0c0ab2e9ba
     1.1 --- a/sourcehook/sourcehook_impl.h	Wed May 04 13:59:57 2005 +0000
     1.2 +++ b/sourcehook/sourcehook_impl.h	Thu May 05 10:40:47 2005 +0000
     1.3 @@ -28,14 +28,16 @@
     1.4  		*/
     1.5  		struct RemoveHookInfo
     1.6  		{
     1.7 -			RemoveHookInfo(Plugin pplug, void *piface, HookManagerPubFunc phookman,
     1.8 +			RemoveHookInfo(Plugin pplug, void *piface, int tpo, HookManagerPubFunc phookman,
     1.9  				ISHDelegate *phandler, bool ppost)
    1.10 -				: plug(pplug), iface(piface), hookman(phookman), handler(phandler), post(ppost)
    1.11 +				: plug(pplug), iface(piface), thisptr_offs(tpo),
    1.12 +				hookman(phookman), handler(phandler), post(ppost)
    1.13  			{
    1.14  			}
    1.15  
    1.16  			Plugin plug;
    1.17  			void *iface;
    1.18 +			int thisptr_offs;
    1.19  			HookManagerPubFunc hookman;
    1.20  			ISHDelegate *handler;
    1.21  			bool post;
    1.22 @@ -70,7 +72,10 @@
    1.23  			const char *proto, int vtblofs, int vtblidx);
    1.24  
    1.25  		void ApplyCallClassPatch(CallClassInfo &cc, int vtbl_offs, int vtbl_idx, void *orig_entry);
    1.26 +		void ApplyCallClassPatches(CallClassInfo &cc);
    1.27 +		void ApplyCallClassPatches(void *ifaceptr, int vtbl_offs, int vtbl_idx, void *orig_entry);
    1.28  		void RemoveCallClassPatch(CallClassInfo &cc, int vtbl_offs, int vtbl_idx);
    1.29 +		void RemoveCallClassPatches(void *ifaceptr, int vtbl_offs, int vtbl_idx);
    1.30  
    1.31  		META_RES m_Status, m_PrevRes, m_CurRes;
    1.32  		const void *m_OrigRet;
    1.33 @@ -81,6 +86,16 @@
    1.34  		~CSourceHookImpl();
    1.35  
    1.36  		/**
    1.37 +		*	@brief Returns the interface version
    1.38 +		*/
    1.39 +		int GetIfaceVersion();
    1.40 +
    1.41 +		/**
    1.42 +		*	@brief Returns the implemnetation version
    1.43 +		*/
    1.44 +		int GetImplVersion();
    1.45 +
    1.46 +		/**
    1.47  		*	@brief Make sure that a plugin is not used by any other plugins anymore, and unregister all its hook managers
    1.48  		*/
    1.49  		void UnloadPlugin(Plugin plug);
    1.50 @@ -121,19 +136,6 @@
    1.51  		/**
    1.52  		*	@brief Removes a hook.
    1.53  		*
    1.54 -		*	@return True if the function succeeded, false otherwise
    1.55 -		*
    1.56 -		*	@param plug The unique identifier of the plugin that calls this function
    1.57 -		*	@param iface Already adjusted interface pointer
    1.58 -		*	@param myHookMan A hook manager function that should be capable of handling the function
    1.59 -		*	@param handler A pointer to a FastDelegate containing the hook handler
    1.60 -		*	@param post Set to true if you want a post handler
    1.61 -		*/
    1.62 -		bool RemoveHook(Plugin plug, void *iface, HookManagerPubFunc myHookMan, ISHDelegate *handler, bool post);
    1.63 -
    1.64 -		/**
    1.65 -		*	@brief Removes a hook.
    1.66 -		*
    1.67  		*	@ return True if the function succeeded, false otherwise
    1.68  		*
    1.69  		*	@param info A RemoveHookInfo structure, describing the hook
    1.70 @@ -165,8 +167,9 @@
    1.71  		*	@brief Return a pointer to a callclass. Generate a new one if required.
    1.72  		*
    1.73  		*	@param iface The interface pointer
    1.74 +		*	@param size Size of the class instance
    1.75  		*/
    1.76 -		GenericCallClass *GetCallClass(void *iface);
    1.77 +		GenericCallClass *GetCallClass(void *iface, size_t size);
    1.78  
    1.79  		/**
    1.80  		*	@brief Release a callclass
    1.81 @@ -184,12 +187,12 @@
    1.82  
    1.83  		//////////////////////////////////////////////////////////////////////////
    1.84  		// For hook managers
    1.85 -		virtual META_RES &GetCurResRef();				//!< Gets the pointer to the current meta result
    1.86 -		virtual META_RES &GetPrevResRef();				//!< Gets the pointer to the previous meta result
    1.87 -		virtual META_RES &GetStatusRef();				//!< Gets the pointer to the status variable
    1.88 +		virtual META_RES &GetCurResRef();				//!< Gets the reference to the current meta result
    1.89 +		virtual META_RES &GetPrevResRef();				//!< Gets the reference to the previous meta result
    1.90 +		virtual META_RES &GetStatusRef();				//!< Gets the reference to the status variable
    1.91 +		virtual void* &GetIfacePtrRef();				//!< Gets the reference to the iface ptr
    1.92  		virtual void SetOrigRet(const void *ptr);		//!< Sets the original return pointer
    1.93  		virtual void SetOverrideRet(const void *ptr);	//!< Sets the override result pointer
    1.94 -		virtual void SetIfacePtr(void *ptr);			//!< Sets the interface this pointer
    1.95  	};
    1.96  }
    1.97