All pastes #76128 Raw Edit

Someone

public cpp v1 · immutable
·published 2006-07-01 03:11 UTC
rendered paste body
#include "w3jdebug.h"CIAT IAT;HMODULE hModuleSelf;HMODULE WINAPI GameLoadLibraryA(LPCSTR lpFileName);// For our patchesextern "C"{	unsigned long			GameGetChatMessage = 0;	void					GameChatInterceptionHook();	extern unsigned char	patch_chat_interception[];}bool ServerStart(){	IAT.SetParentModule(GetModuleHandle(0));	IAT.LocateForModule("kernel32.dll");	IAT.RedirectImport("LoadLibraryA", GameLoadLibraryA);	return true;}void ServerStop(){	// check to see if the jass debugger is initialized before freeing any memory}void GameDllPostLoad(HMODULE hModuleGame){	PIMAGE_SECTION_HEADER SectionText = GetImageSectionHeader(hModuleGame, ".text\0\0\0");	unsigned char *low, *high;	low		= (unsigned char*)hModuleGame + SectionText->VirtualAddress;	high	= low + SectionText->Misc.VirtualSize;	DoPatch(patch_chat_interception, low, high);}HMODULE WINAPI GameLoadLibraryA(LPCSTR lpFileName){	HMODULE hModule = LoadLibraryA(lpFileName);	if (_strcmpi(lpFileName, "game.dll") == 0)		GameDllPostLoad(hModule);	return hModule;}#define WORLDFRAMEMESSAGE		0#define WORLDFRAMEUNITMESSAGE	1#define WORLDFRAMECHATMESSAGE	2#define WORLDFRAMETOPMESSAGE	3__declspec (naked)void __stdcall GamePrintUIMessage(char *message, float seconds, unsigned long alpha, unsigned char UI = WORLDFRAMECHATMESSAGE){	__asm	{		mov edx, [esp+0x10]		cmp edx, 3		jbe far $+7		ret		push 0		push [esp+0xC]		lea eax, [esp+0x14]		push eax		push [esp+0x10]		mov ecx, dword ptr ds:[0x6F86E424]		; Some big object		mov ecx, [ecx+0x3D8+4*edx]				; Frame objects located at 3D8, 3DC, 3E0, and 3E4		mov edx, [ecx]							; edx = 0x6F65F720		call dword ptr ds:[edx+0x6C]		ret 0x10	}}char * __fastcall OnGameTypedChatMessage(char *message){	char msg[200];	wsprintf(msg, "|c00C000F0You just typed: |r|c0000FF00%s|r", message);	GamePrintUIMessage(msg, 20.0, 0xFFFFFFFF, 0);	GamePrintUIMessage(msg, 20.0, 0xFFFFFFFF, 1);	GamePrintUIMessage(msg, 20.0, 0xFFFFFFFF, 2);	GamePrintUIMessage(msg, 20.0, 0xFFFFFFFF, 3);	return 0;}__declspec(naked) void GameChatInterceptionHook(){	__asm	{		call GameGetChatMessage		mov ecx, eax		cmp byte ptr ds:[eax], 0		jne OnGameTypedChatMessage		ret	}}