| Third party suicide hook crashes with beta 5 [message #469928] | 
			Tue, 26 June 2012 11:38   | 
		 
		
			
				
				
				
					
						  
						iRANian
						 Messages: 4313 Registered: April 2011 
						
	Karma: 1
 
					 | 
					General (4 Stars)  | 
					 | 
		 
		 
	 | 
 
	
		I've been using a suicide hook from the OnOeS bot released by Hex for a plugin (Suicide5MinWait), it works just fine with beta 4 but with beta 5 it crashes (even if I change the hook to just print something to the console): 
 
Hook *Suicide = new Hook;
 
void __cdecl Suicide_Hook(int PlayerID)
{
	Console_Output("test\n");
}
void __declspec(naked) Suicide_Glue()
{
	__asm
	{
		mov eax, [edi+6B4h];
		push eax;
		call Suicide_Hook;
		add esp, 4;
		pop edi;
		pop ecx;
		retn;
	}
}
Suicide5MinWait::Suicide5MinWait()
{
	RegisterEvent(EVENT_LOAD_LEVEL_HOOK,this);
	RegisterEvent(EVENT_PLAYER_LEAVE_HOOK,this);
	Suicide->Install('\xE9', 0x004BA144, (int)&Suicide_Glue, "");
} 
		
		
  Long time and well respected Renegade community member, programmer, modder and tester. 
 
Scripts 4.0 private beta tester since May 2011. 
 
My Renegade server plugins releases
		
 |  
	| 
		
	 | 
 
 
 | 
	
		
		
			| Re: Third party suicide hook crashes with beta 5 [message #469961 is a reply to message #469928] | 
			Tue, 26 June 2012 14:25    | 
		 
		
			
				
				
				  | 
					
						  
						Whitedragon
						 Messages: 832 Registered: February 2003  Location: California
						
	Karma: 1
 
					 | 
					Colonel  | 
					 | 
		 
		 
	 | 
 
	
		Mine still works fine. 
 
void __declspec(naked) Suicide_Hook() {
	__asm {
		mov eax, [ecx+6B4h]
		push eax
		call DAEventManager::Suicide_Event
		add esp, 4
		ret
	}
}
void InitEngineDA() {
	DAMemoryPatcher::Install_Jump_Hook(0x004BA140,Suicide_Hook); //Hook cSuicideEvent::Act
}
 
		
		
  Black-Cell.net 
Network Administrator (2003 - ) 
 
DragonServ, Renegade's first IRC interface bot 
Creator and lead coder (2002 - ) 
 
Dragonade, Renegade's first server side modification 
Lead coder (2005 - )
		
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 |