updated
logs with time now.
made for june2007, july2008 and oct2008 just by changing the
Code:
#include "stdafx.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <time.h>
#include <detours.h>
//#pragma comment( lib, "Detours.lib") //This isn't needed, don't know why I keep doing that
#include <CDetour.h>
#pragma comment( lib, "CDetour" )
using namespace std;
#define June07
#ifdef June07
const unsigned long MMatchServerGetInstanceAddress = 0x0040ED00;
const unsigned long MMatchServerGetObjectAAdress = 0x00411090;
const unsigned long MMatchServerOnChatRoomChatAddress = 0x00412B10;
const unsigned long MMatchServerOnChannelChatAddress = 0x00454E80;
const unsigned long MMatchServerOnStageChatAddress = 0x0045DEA0;
const unsigned long MMatchObjectGetNameAddress = 0x0040F180;
#endif
#ifdef July08
const unsigned long MMatchServerGetInstanceAddress = 0x0041E3C0;
const unsigned long MMatchServerGetObjectAAdress = 0x00420690;
const unsigned long MMatchServerOnChatRoomChatAddress = 0x00421F80;
const unsigned long MMatchServerOnChannelChatAddress = 0x00471F20;
const unsigned long MMatchServerOnStageChatAddress = 0x0044B730;
const unsigned long MMatchObjectGetNameAddress = 0x0041E860;
#endif
#ifdef Oct08
const unsigned long MMatchServerGetInstanceAddress = 0x0041E640;
const unsigned long MMatchServerGetObjectAAdress = 0x00420960;
const unsigned long MMatchServerOnChatRoomChatAddress = 0x00422280;
const unsigned long MMatchServerOnChannelChatAddress = 0x004729C0;
const unsigned long MMatchServerOnStageChatAddress = 0x0044B760;
const unsigned long MMatchObjectGetNameAddress = 0x0041EAA0;
#endif
struct MUID
{
unsigned long Low;
unsigned long High;
};
struct MMatchObject
{
char* GetName( )
{
return ( ( char* ( __thiscall* ) ( LPVOID ) )MMatchObjectGetNameAddress )( this );
}
};
struct MMatchServer
{
static MMatchServer* GetInstance( )
{
return ( ( MMatchServer *( __cdecl * )( ) )MMatchServerGetInstanceAddress )( );
}
MMatchObject* GetObjectA( MUID* uidPlayer )
{
return ( ( MMatchObject *( __thiscall * ) ( LPVOID, MUID* ) )MMatchServerGetObjectAAdress )( this, uidPlayer );
}
};
char* Time( )
{
time_t lTime;
struct tm* TM;
lTime = time( NULL );
TM = localtime( &lTime );
char szBuffer[25];
sprintf_s( szBuffer, "[%d:%d:%d]", TM->tm_mday, TM->tm_hour, TM->tm_min );
return szBuffer;
}
CDetour MMatchServerOnChatRoomChatDet;
void WINAPI MMatchServerOnChatRoomChatHook( MUID* uidPlayer, const char* szMessage )
{
ofstream ChatRoomFile;
char szBuffer[2000];
sprintf_s( szBuffer, "%s %s: %s\n", Time( ), MMatchServer::GetInstance()->GetObjectA( uidPlayer )->GetName( ), szMessage );
ChatRoomFile << szBuffer;
MMatchServerOnChatRoomChatDet.Org( uidPlayer, szMessage );
}
CDetour MMatchServerOnChannelChatDet;
void WINAPI MMatchServerOnChannelChatHook( MUID* uidPlayer, MUID* uidChannel, char* szMessage )
{
ofstream ChannelFile;
ChannelFile.open( "ChannelChat Log.txt", ios::app );
char szBuffer[2000];
sprintf_s( szBuffer, "%s %s: %s\n", Time( ), MMatchServer::GetInstance()->GetObjectA( uidPlayer )->GetName( ), szMessage );
ChannelFile << szBuffer;
MMatchServerOnChannelChatDet.Org( uidPlayer, uidChannel, szMessage );
}
CDetour MMatchServerOnStageChatDet;
void WINAPI MMatchServerOnStageChatHook( MUID* uidPlayer, MUID* uidStage, char* szMessage )
{
ofstream StageFile;
StageFile.open( "StageChat Log.txt", ios::app );
char szBuffer[4024];
sprintf_s( szBuffer, "%s %s: %s\n", Time( ), MMatchServer::GetInstance()->GetObjectA( uidPlayer )->GetName( ), szMessage );
StageFile << szBuffer;
MMatchServerOnStageChatDet.Org( uidPlayer, uidStage, szMessage );
}
DWORD WINAPI MainThread( )
{
MMatchServerOnChatRoomChatDet.Detour( (PBYTE)MMatchServerOnChatRoomChatAddress, (PBYTE)MMatchServerOnChatRoomChatHook );
MMatchServerOnChatRoomChatDet.Apply( );
MMatchServerOnChannelChatDet.Detour( (PBYTE)MMatchServerOnChannelChatAddress, (PBYTE)MMatchServerOnChannelChatHook );
MMatchServerOnChannelChatDet.Apply( );
MMatchServerOnStageChatDet.Detour( (PBYTE)MMatchServerOnStageChatAddress, (PBYTE)MMatchServerOnStageChatHook );
MMatchServerOnStageChatDet.Apply( );
return 0;
}
extern "C" __declspec( dllexport ) BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls( hInstance );
if( dwReason == DLL_PROCESS_ATTACH )
CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)&MainThread, NULL, NULL, NULL );
return TRUE;
}
heres the outcome when I chatted in the channel.
ChannelChat Log.txt:
Code:
[11:20:37] TwistedMind: phoenix is a little pecker
[11:20:37] TwistedMind: ;D
[11:20:37] TwistedMind: rofl
the time goes like this
(day - hour - minute)
inject into matchServer and itll do all the work.