sourcehook/sourcehook.cpp
changeset 6 4803fd7d28bb
parent 1 586787053c73
child 8 07e339563a28
     1.1 --- a/sourcehook/sourcehook.cpp	Thu Apr 14 16:19:07 2005 +0000
     1.2 +++ b/sourcehook/sourcehook.cpp	Sat Apr 16 16:55:53 2005 +0000
     1.3 @@ -83,18 +83,18 @@
     1.4  
     1.5  	bool CSourceHookImpl::IsPluginInUse(Plugin plug)
     1.6  	{
     1.7 -		// Iterate through all hookers which are in this plugin
     1.8 +		// Iterate through all hook managers which are in this plugin
     1.9  		// Iterate through their hooks
    1.10  		// If a hook from an other plugin is found, return true
    1.11  		// Return false otherwise
    1.12  
    1.13 -		for (HookerInfoList::iterator iter = m_Hookers.begin(); iter != m_Hookers.end(); ++iter)
    1.14 +		for (HookManInfoList::iterator iter = m_HookMans.begin(); iter != m_HookMans.end(); ++iter)
    1.15  		{
    1.16  			if (iter->plug == plug && !iter->ifaces.empty())
    1.17  			{
    1.18 -				for (std::list<HookerInfo::Iface>::iterator iter2 = iter->ifaces.begin(); iter2 != iter->ifaces.end(); ++iter2)
    1.19 +				for (std::list<HookManagerInfo::Iface>::iterator iter2 = iter->ifaces.begin(); iter2 != iter->ifaces.end(); ++iter2)
    1.20  				{
    1.21 -					std::list<HookerInfo::Iface::Hook>::iterator iter3;
    1.22 +					std::list<HookManagerInfo::Iface::Hook>::iterator iter3;
    1.23  					for (iter3 = iter2->hooks_pre.begin(); iter3 != iter2->hooks_pre.end(); ++iter3)
    1.24  						if (iter3->plug == plug)
    1.25  							return true;
    1.26 @@ -109,41 +109,43 @@
    1.27  
    1.28  	void CSourceHookImpl::UnloadPlugin(Plugin plug)
    1.29  	{
    1.30 -		// Get a list of hookers that are in this plugin and are used by other plugins
    1.31 +		// 1) Manually remove all hooks by this plugin
    1.32 +		std::list<RemoveHookInfo> hookstoremove;
    1.33 +
    1.34 +		for (HookManInfoList::iterator iter = m_HookMans.begin(); iter != m_HookMans.end(); ++iter)
    1.35 +		{
    1.36 +			for (std::list<HookManagerInfo::Iface>::iterator iter2 = iter->ifaces.begin(); iter2 != iter->ifaces.end();
    1.37 +				++iter2)
    1.38 +			{
    1.39 +				for (std::list<HookManagerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_pre.begin(); iter3 != iter2->hooks_pre.end(); ++iter3)
    1.40 +					if (iter3->plug == plug)
    1.41 +						hookstoremove.push_back(RemoveHookInfo(iter3->plug, iter2->ptr, iter->func, iter3->handler, false));
    1.42  
    1.43 -		HookerInfoList tmphookers;
    1.44 +				for (std::list<HookManagerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_post.begin(); iter3 != iter2->hooks_post.end(); ++iter3)
    1.45 +					if (iter3->plug == plug)
    1.46 +						hookstoremove.push_back(RemoveHookInfo(iter3->plug, iter2->ptr, iter->func, iter3->handler, true));
    1.47 +			}
    1.48 +		}
    1.49 +
    1.50 +		for (std::list<RemoveHookInfo>::iterator rmiter = hookstoremove.begin(); rmiter != hookstoremove.end(); ++rmiter)
    1.51 +			RemoveHook(rmiter->plug, rmiter->iface, rmiter->hpf, rmiter->handler, rmiter->post);
    1.52 +
    1.53 +		// 2) Other plugins may use hook managers in this plugin.
    1.54 +		// Get a list of hook managers that are in this plugin and are used by other plugins
    1.55 +		// Delete all hook managers that are in this plugin
    1.56 +
    1.57 +		HookManInfoList tmphookmans;
    1.58  		bool erase = false;
    1.59 -		for (HookerInfoList::iterator iter = m_Hookers.begin(); iter != m_Hookers.end();
    1.60 -			erase ? iter=m_Hookers.erase(iter) : ++iter)
    1.61 +		for (HookManInfoList::iterator iter = m_HookMans.begin(); iter != m_HookMans.end();
    1.62 +			erase ? iter=m_HookMans.erase(iter) : ++iter)
    1.63  		{
    1.64 -			if (iter->plug == plug && !iter->ifaces.empty())
    1.65 +			if (iter->plug == plug)
    1.66  			{
    1.67 -				bool found = false;
    1.68 -				for (std::list<HookerInfo::Iface>::iterator iter2 = iter->ifaces.begin();
    1.69 -					iter2 != iter->ifaces.end(); ++iter2)
    1.70 +				if (!iter->ifaces.empty())
    1.71  				{
    1.72 -					for (std::list<HookerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_pre.begin();
    1.73 -						iter3 != iter2->hooks_pre.end(); ++iter3)
    1.74 -					{
    1.75 -						if (iter3->plug != plug)
    1.76 -						{
    1.77 -							found = true;
    1.78 -							break;
    1.79 -						}
    1.80 -					}
    1.81 -					for (iter3 = iter2->hooks_post.begin(); iter3 != iter2->hooks_post.end(); ++iter3)
    1.82 -					{
    1.83 -						if (iter3->plug != plug)
    1.84 -						{
    1.85 -							found = true;
    1.86 -							break;
    1.87 -						}
    1.88 -					}
    1.89 -					if (found)
    1.90 -					{
    1.91 -						tmphookers.push_back(*iter);
    1.92 -						break;
    1.93 -					}
    1.94 +					// All hooks by this plugin are already removed
    1.95 +					// So if there is an iface, it has to be used by an other plugin
    1.96 +					tmphookmans.push_back(*iter);
    1.97  				}
    1.98  				erase = true;
    1.99  			}
   1.100 @@ -151,120 +153,106 @@
   1.101  				erase = false;
   1.102  		}
   1.103  		
   1.104 -		// For each hooker:
   1.105 -		for (HookerInfoList::iterator iter = tmphookers.begin(); iter != tmphookers.end(); ++iter)
   1.106 +		// For each hook manager:
   1.107 +		for (HookManInfoList::iterator iter = tmphookmans.begin(); iter != tmphookmans.end(); ++iter)
   1.108  		{
   1.109 -			// Shutdown all ifaces and remove the hooks from this plugin from their lists
   1.110 -			for (std::list<HookerInfo::Iface>::iterator iter2 = iter->ifaces.begin(); iter2 != iter->ifaces.end();
   1.111 -				erase ? iter2 = iter->ifaces.erase(iter2) : ++iter2)
   1.112 -			{
   1.113 -				*(reinterpret_cast<void**>(reinterpret_cast<char*>(iter2->ptr) + iter->vtbl_offs) 
   1.114 -					+ iter->vtbl_idx) = iter2->orig_entry;
   1.115 -
   1.116 -				for (std::list<HookerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_pre.begin(); iter3 != iter2->hooks_pre.end();
   1.117 -					iter3->plug == plug ? iter3=iter2->hooks_pre.erase(iter3) : ++iter3) {}
   1.118 -				for (std::list<HookerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_post.begin(); iter3 != iter2->hooks_post.end();
   1.119 -					iter3->plug == plug ? iter3=iter2->hooks_post.erase(iter3) : ++iter3) {}
   1.120 -				
   1.121 -				erase = iter2->hooks_pre.empty() && iter2->hooks_post.empty();
   1.122 -			}
   1.123 -			
   1.124 -			if (iter->ifaces.empty())
   1.125 -			{
   1.126 -				// Nothing more to do; no more ifaces to re-register
   1.127 -				continue;
   1.128 -			}
   1.129 -
   1.130 -			// 2) Find a suitable hooker in an other plugin
   1.131 -			HookerInfoList::iterator newHooker = FindHooker(m_Hookers.begin(), m_Hookers.end(),
   1.132 +			// Find a suitable hook manager in an other plugin
   1.133 +			HookManInfoList::iterator newHookMan = FindHookMan(m_HookMans.begin(), m_HookMans.end(),
   1.134  				iter->proto, iter->vtbl_offs, iter->vtbl_idx, iter->thisptr_offs);
   1.135 -			if (newHooker == m_Hookers.end())
   1.136 +			if (newHookMan == m_HookMans.end())
   1.137  			{
   1.138  				// This should _never_ happen.
   1.139 -				// If there is a hook from an other plugin, the plugin must have provided a hooker as well.
   1.140 +				// If there is a hook from an other plugin, the plugin must have provided a hook manager as well.
   1.141  				SH_ASSERT(0);
   1.142  			}
   1.143  
   1.144 -			// AddHook should make sure that every plugin only has _one_ hooker for _one_ proto/vi/vo
   1.145 -			SH_ASSERT(newHooker->plug != plug);
   1.146 +			// AddHook should make sure that every plugin only has _one_ hook manager for _one_ proto/vi/vo/thisptroffs
   1.147 +			SH_ASSERT(newHookMan->plug != plug);
   1.148 +
   1.149 +			// The first hooker should be always used - so the new hook manager has to be empty
   1.150 +			SH_ASSERT(newHookMan->ifaces.empty());
   1.151  
   1.152 -			// 3) Register it!
   1.153 -			newHooker->func(HA_Register, &(*iter));
   1.154 -			for (std::list<HookerInfo::Iface>::iterator iter2 = iter->ifaces.begin(); iter2 != iter->ifaces.end();
   1.155 -				++iter2)
   1.156 -			{
   1.157 -				reinterpret_cast<void**>(reinterpret_cast<char*>(iter2->ptr) + iter->vtbl_offs)[iter->vtbl_idx] =
   1.158 -					reinterpret_cast<void**>(reinterpret_cast<char*>(iter->hookfunc_inst) + iter->hookfunc_vtbl_offs)[iter->hookfunc_vtbl_idx];
   1.159 -			}
   1.160 +			// Move the ifaces from the old hook manager to the new one
   1.161 +			newHookMan->ifaces = iter->ifaces;
   1.162 +
   1.163 +			// Unregister the old one, register the new one
   1.164 +			iter->func(HA_Unregister, NULL);
   1.165 +			newHookMan->func(HA_Register, &(*newHookMan));
   1.166  		}
   1.167  	}
   1.168  
   1.169  	void CSourceHookImpl::CompleteShutdown()
   1.170  	{
   1.171 -		// Go through all hookers and shut down all interfaces
   1.172 -		for (HookerInfoList::iterator iter = m_Hookers.begin(); iter != m_Hookers.end(); ++iter)
   1.173 +		std::list<RemoveHookInfo> hookstoremove;
   1.174 +
   1.175 +		for (HookManInfoList::iterator iter = m_HookMans.begin(); iter != m_HookMans.end(); ++iter)
   1.176  		{
   1.177 -			for (std::list<HookerInfo::Iface>::iterator iter2 = iter->ifaces.begin(); iter2 != iter->ifaces.end(); ++iter2)
   1.178 +			for (std::list<HookManagerInfo::Iface>::iterator iter2 = iter->ifaces.begin(); iter2 != iter->ifaces.end();
   1.179 +				++iter2)
   1.180  			{
   1.181 -				// Note that we can pass iter->func as "myHooker" because it is only used
   1.182 -				// to retreive data
   1.183 -				for (std::list<HookerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_pre.begin(); iter3 != iter2->hooks_pre.end(); ++iter3)
   1.184 -					RemoveHook(iter3->plug, iter2->ptr, iter->func, iter3->handler, false);
   1.185 -				for (std::list<HookerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_post.begin(); iter3 != iter2->hooks_post.end(); ++iter3)
   1.186 -					RemoveHook(iter3->plug, iter2->ptr, iter->func, iter3->handler, true);
   1.187 +				for (std::list<HookManagerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_pre.begin(); iter3 != iter2->hooks_pre.end(); ++iter3)
   1.188 +					hookstoremove.push_back(RemoveHookInfo(iter3->plug, iter2->ptr, iter->func, iter3->handler, false));
   1.189 +				
   1.190 +				for (std::list<HookManagerInfo::Iface::Hook>::iterator iter3 = iter2->hooks_post.begin(); iter3 != iter2->hooks_post.end(); ++iter3)
   1.191 +					hookstoremove.push_back(RemoveHookInfo(iter3->plug, iter2->ptr, iter->func, iter3->handler, true));
   1.192  			}
   1.193  		}
   1.194 +
   1.195 +		for (std::list<RemoveHookInfo>::iterator rmiter = hookstoremove.begin(); rmiter != hookstoremove.end(); ++rmiter)
   1.196 +			RemoveHook(rmiter->plug, rmiter->iface, rmiter->hpf, rmiter->handler, rmiter->post);
   1.197 +
   1.198 +		m_HookMans.clear();
   1.199  	}
   1.200  
   1.201 -	bool CSourceHookImpl::AddHook(Plugin plug, void *iface, int ifacesize, Hooker myHooker, ISHDelegate *handler, bool post)
   1.202 +	bool CSourceHookImpl::AddHook(Plugin plug, void *iface, int ifacesize, HookManagerPubFunc myHookMan, ISHDelegate *handler, bool post)
   1.203  	{
   1.204 -		// 1) Get info about the hooker
   1.205 -		HookerInfo tmp;
   1.206 -		if (myHooker(HA_GetInfo, &tmp) != 0)
   1.207 +		// 1) Get info about the hook manager
   1.208 +		HookManagerInfo tmp;
   1.209 +		if (myHookMan(HA_GetInfo, &tmp) != 0)
   1.210  			return false;
   1.211  
   1.212 -		// Add the proposed hooker to the _end_ of the list if the plugin doesn't have a hooker with this proto/vo/vi registered
   1.213 -		HookerInfoList::iterator hookeriter;
   1.214 -		for (hookeriter = m_Hookers.begin(); hookeriter != m_Hookers.end(); ++hookeriter)
   1.215 +		// Add the proposed hook manager to the _end_ of the list if the plugin doesn't have a hook manager with this proto/vo/vi registered
   1.216 +		HookManInfoList::iterator hookmaniter;
   1.217 +		for (hookmaniter = m_HookMans.begin(); hookmaniter != m_HookMans.end(); ++hookmaniter)
   1.218  		{
   1.219 -			if (hookeriter->plug == plug && strcmp(hookeriter->proto, tmp.proto) == 0 &&
   1.220 -				hookeriter->vtbl_offs == tmp.vtbl_offs && hookeriter->vtbl_idx == tmp.vtbl_idx &&
   1.221 -				hookeriter->thisptr_offs == tmp.thisptr_offs)
   1.222 +			if (hookmaniter->plug == plug && strcmp(hookmaniter->proto, tmp.proto) == 0 &&
   1.223 +				hookmaniter->vtbl_offs == tmp.vtbl_offs && hookmaniter->vtbl_idx == tmp.vtbl_idx &&
   1.224 +				hookmaniter->thisptr_offs == tmp.thisptr_offs)
   1.225  				break;
   1.226  		}
   1.227 -		if (hookeriter == m_Hookers.end())
   1.228 +		if (hookmaniter == m_HookMans.end())
   1.229  		{
   1.230 -			// No such hooker from this plugin yet, add it!
   1.231 -			tmp.func = myHooker;
   1.232 +			// No such hook manager from this plugin yet, add it!
   1.233 +			tmp.func = myHookMan;
   1.234  			tmp.plug = plug;
   1.235 -			m_Hookers.push_back(tmp);
   1.236 +			m_HookMans.push_back(tmp);
   1.237  		}
   1.238  
   1.239 -		// Then, search for a suitable hooker (from the beginning)
   1.240 -		HookerInfoList::iterator hooker = FindHooker(m_Hookers.begin(), m_Hookers.end(), tmp.proto, tmp.vtbl_offs, tmp.vtbl_idx, tmp.thisptr_offs);
   1.241 -		SH_ASSERT(hooker != m_Hookers.end());
   1.242 +		// Then, search for a suitable hook manager (from the beginning)
   1.243 +		HookManInfoList::iterator hookman = FindHookMan(m_HookMans.begin(), m_HookMans.end(), tmp.proto, tmp.vtbl_offs, tmp.vtbl_idx, tmp.thisptr_offs);
   1.244 +		SH_ASSERT(hookman != m_HookMans.end());
   1.245  
   1.246  		// Tell it to store the pointer if it's not already active
   1.247 -		if (hooker->ifaces.empty())
   1.248 -			hooker->func(HA_Register, &(*hooker));
   1.249 +		if (hookman->ifaces.empty())
   1.250 +			hookman->func(HA_Register, &(*hookman));
   1.251  
   1.252 -		std::list<HookerInfo::Iface>::iterator ifsiter = std::find(hooker->ifaces.begin(), hooker->ifaces.end(), iface);
   1.253 +		std::list<HookManagerInfo::Iface>::iterator ifsiter = std::find(hookman->ifaces.begin(), hookman->ifaces.end(), iface);
   1.254  
   1.255 -		if (ifsiter == hooker->ifaces.end())
   1.256 +		if (ifsiter == hookman->ifaces.end())
   1.257  		{
   1.258 -			HookerInfo::Iface ifs;
   1.259 +			HookManagerInfo::Iface ifs;
   1.260  			ifs.ptr = iface;
   1.261  			ifs.callclass = GetCallClass(iface, ifacesize);
   1.262 -			void *vtableptr = *reinterpret_cast<void**>(reinterpret_cast<char*>(iface) + hooker->vtbl_offs);
   1.263 -			SetMemAccess(vtableptr, sizeof(void*) * hooker->vtbl_idx, SH_MEM_READ | SH_MEM_WRITE);
   1.264 -			ifs.orig_entry = (*reinterpret_cast<void***>(reinterpret_cast<char*>(iface) + hooker->vtbl_offs))[hooker->vtbl_idx];
   1.265 -			(*reinterpret_cast<void***>(reinterpret_cast<char*>(iface) + hooker->vtbl_offs))[hooker->vtbl_idx] =
   1.266 -				(*reinterpret_cast<void***>(reinterpret_cast<char*>(hooker->hookfunc_inst) + hooker->hookfunc_vtbl_offs))[hooker->hookfunc_vtbl_idx];
   1.267 -			hooker->ifaces.push_back(ifs);
   1.268 -			ifsiter = hooker->ifaces.end();
   1.269 +			void *vtableptr = *reinterpret_cast<void**>(reinterpret_cast<char*>(iface) + hookman->vtbl_offs);
   1.270 +			SetMemAccess(vtableptr, sizeof(void*) * hookman->vtbl_idx, SH_MEM_READ | SH_MEM_WRITE);
   1.271 +			ifs.orig_entry = (*reinterpret_cast<void***>(reinterpret_cast<char*>(iface) + hookman->vtbl_offs))[hookman->vtbl_idx];
   1.272 +			(*reinterpret_cast<void***>(reinterpret_cast<char*>(iface) + hookman->vtbl_offs))[hookman->vtbl_idx] =
   1.273 +				(*reinterpret_cast<void***>(reinterpret_cast<char*>(hookman->hookfunc_inst) + hookman->hookfunc_vtbl_offs))[hookman->hookfunc_vtbl_idx];
   1.274 +			hookman->ifaces.push_back(ifs);
   1.275 +			ifsiter = hookman->ifaces.end();
   1.276  			--ifsiter;
   1.277  		}
   1.278 -		HookerInfo::Iface::Hook hookinfo;
   1.279 +		HookManagerInfo::Iface::Hook hookinfo;
   1.280  		hookinfo.handler = handler;
   1.281  		hookinfo.plug = plug;
   1.282  		if (post)
   1.283 @@ -288,25 +276,25 @@
   1.284  		return true;
   1.285  	}
   1.286  
   1.287 -	bool CSourceHookImpl::RemoveHook(Plugin plug, void *iface, Hooker myHooker, ISHDelegate *handler, bool post)
   1.288 +	bool CSourceHookImpl::RemoveHook(Plugin plug, void *iface, HookManagerPubFunc myHookMan, ISHDelegate *handler, bool post)
   1.289  	{
   1.290 -		HookerInfo tmp;
   1.291 -		if (myHooker(HA_GetInfo, &tmp) != 0)
   1.292 +		HookManagerInfo tmp;
   1.293 +		if (myHookMan(HA_GetInfo, &tmp) != 0)
   1.294  			return false;
   1.295  
   1.296 -		// Find the hooker and the hook
   1.297 -		HookerInfoList::iterator hooker = FindHooker(m_Hookers.begin(), m_Hookers.end(), 
   1.298 +		// Find the hook manager and the hook
   1.299 +		HookManInfoList::iterator hookman = FindHookMan(m_HookMans.begin(), m_HookMans.end(), 
   1.300  			tmp.proto, tmp.vtbl_offs, tmp.vtbl_idx, tmp.thisptr_offs);
   1.301 -		if (hooker == m_Hookers.end())
   1.302 +		if (hookman == m_HookMans.end())
   1.303  			return false;
   1.304  
   1.305 -		for (std::list<HookerInfo::Iface>::iterator ifaceiter = hooker->ifaces.begin(); ifaceiter != hooker->ifaces.end(); ++ifaceiter)
   1.306 +		for (std::list<HookManagerInfo::Iface>::iterator ifaceiter = hookman->ifaces.begin(); ifaceiter != hookman->ifaces.end(); ++ifaceiter)
   1.307  		{
   1.308  			if (ifaceiter->ptr == iface)
   1.309  			{
   1.310 -				std::list<HookerInfo::Iface::Hook> &hooks = post ? ifaceiter->hooks_post : ifaceiter->hooks_pre;
   1.311 +				std::list<HookManagerInfo::Iface::Hook> &hooks = post ? ifaceiter->hooks_post : ifaceiter->hooks_pre;
   1.312  				bool erase;
   1.313 -				for (std::list<HookerInfo::Iface::Hook>::iterator hookiter = hooks.begin();
   1.314 +				for (std::list<HookManagerInfo::Iface::Hook>::iterator hookiter = hooks.begin();
   1.315  					hookiter != hooks.end(); erase ? hookiter = hooks.erase(hookiter) : ++hookiter)
   1.316  				{
   1.317  					erase = hookiter->plug == plug && hookiter->handler->IsEqual(handler);
   1.318 @@ -317,16 +305,16 @@
   1.319  				{
   1.320  					// Deactivate the hook
   1.321  					(*reinterpret_cast<void***>(reinterpret_cast<char*>(ifaceiter->ptr) +
   1.322 -						hooker->vtbl_offs))[hooker->vtbl_idx]= ifaceiter->orig_entry;
   1.323 +						hookman->vtbl_offs))[hookman->vtbl_idx]= ifaceiter->orig_entry;
   1.324  
   1.325  					// Release the callclass
   1.326  					ReleaseCallClass(ifaceiter->callclass);
   1.327  
   1.328  					// Remove the iface info
   1.329 -					hooker->ifaces.erase(ifaceiter);
   1.330 +					hookman->ifaces.erase(ifaceiter);
   1.331  
   1.332 -					if (hooker->ifaces.empty())
   1.333 -						hooker->func(HA_Unregister, NULL);
   1.334 +					if (hookman->ifaces.empty())
   1.335 +						hookman->func(HA_Unregister, NULL);
   1.336  				}
   1.337  				// :TODO: Better return value? Or none?
   1.338  				return true;
   1.339 @@ -361,13 +349,13 @@
   1.340  		tmp.refcounter = 1;
   1.341  
   1.342  		// Go through _all_ hooks and apply any needed patches
   1.343 -		for (HookerInfoList::iterator hooker = m_Hookers.begin(); hooker != m_Hookers.end(); ++hooker)
   1.344 +		for (HookManInfoList::iterator hookman = m_HookMans.begin(); hookman != m_HookMans.end(); ++hookman)
   1.345  		{
   1.346 -			for (std::list<HookerInfo::Iface>::iterator ifaceiter = hooker->ifaces.begin(); ifaceiter != hooker->ifaces.end(); ++ifaceiter)
   1.347 +			for (std::list<HookManagerInfo::Iface>::iterator ifaceiter = hookman->ifaces.begin(); ifaceiter != hookman->ifaces.end(); ++ifaceiter)
   1.348  			{
   1.349  				if (ifaceiter->ptr == iface)
   1.350  				{
   1.351 -					if (!ApplyCallClassPatch(tmp, hooker->vtbl_offs, hooker->vtbl_idx, ifaceiter->orig_entry))
   1.352 +					if (!ApplyCallClassPatch(tmp, hookman->vtbl_offs, hookman->vtbl_idx, ifaceiter->orig_entry))
   1.353  					{
   1.354  						FreeCallClass(tmp);
   1.355  						return NULL;
   1.356 @@ -479,16 +467,16 @@
   1.357  	}
   1.358  
   1.359  
   1.360 -	CSourceHookImpl::HookerInfoList::iterator CSourceHookImpl::FindHooker(HookerInfoList::iterator begin,
   1.361 -		HookerInfoList::iterator end, const char *proto, int vtblofs, int vtblidx, int thisptrofs)
   1.362 +	CSourceHookImpl::HookManInfoList::iterator CSourceHookImpl::FindHookMan(HookManInfoList::iterator begin,
   1.363 +		HookManInfoList::iterator end, const char *proto, int vtblofs, int vtblidx, int thisptrofs)
   1.364  	{
   1.365 -		for (HookerInfoList::iterator hookeriter = m_Hookers.begin(); hookeriter != m_Hookers.end(); ++hookeriter)
   1.366 +		for (HookManInfoList::iterator hookmaniter = m_HookMans.begin(); hookmaniter != m_HookMans.end(); ++hookmaniter)
   1.367  		{
   1.368 -			if (strcmp(hookeriter->proto, proto) == 0 && hookeriter->vtbl_offs == vtblofs && hookeriter->vtbl_idx == vtblidx &&
   1.369 -				hookeriter->thisptr_offs == thisptrofs)
   1.370 +			if (strcmp(hookmaniter->proto, proto) == 0 && hookmaniter->vtbl_offs == vtblofs && hookmaniter->vtbl_idx == vtblidx &&
   1.371 +				hookmaniter->thisptr_offs == thisptrofs)
   1.372  				break;
   1.373  		}
   1.374 -		return hookeriter;
   1.375 +		return hookmaniter;
   1.376  	}
   1.377  
   1.378