CoolMW3 SP/MP External Console

Posts 1–12 of 12 · Page 1 of 1
MW3 SP/MP External Console
A dude asked for an external console for TeknoMW3, and I decided to do it for him and for anyone else interested. This works with absolutely anything, Steam version, IW5M, no matter if Multiplayer or Singleplayer -- it should work for all versions.

Code:
#include <windows.h>
#include <stdio.h>

bool Compare(const BYTE* pData, const BYTE* bMask, const char* szMask)
{
	for(;*szMask;++szMask,++pData,++bMask)
		if(*szMask=='x' && *pData!=*bMask)   return 0;
	return (*szMask) == NULL;
}

DWORD FindPattern(BYTE *bMask,char * szMask)
{
	DWORD dwAddress = (DWORD)GetModuleHandleA("iw5mp.exe"), //make sure this is the right executable
		dwLen = 0x1036000; //should have enough length

	for(DWORD i=0; i<dwLen; i++)
		if (Compare((BYTE*)(dwAddress+i),bMask,szMask))  return (DWORD)(dwAddress+i);
	return 0;
}

DWORD WINAPI PatchMW3_Console(LPVOID lpParam)
{
	DWORD addr = FindPattern(
			(BYTE*)"\x83\x3d\x00\x00\x00\x00\x00\x75\x00\x6a\x00\xff\x15\x00\x00\x00\x00\x50\xe8\x00\x00\x00\x00\x83\xc4\x04", 
			"xx?????x?xxxx????xx????xxx");

	// Calls Sys_CreateConsole
	((void)(*)()addr)();
	
	struct tagMSG Msg;
	
	while(true)
	{
		if(GetMessageA(&Msg, NULL, NULL, NULL))
		{
			TranslateMessage(&Msg);
			DispatchMessageA(&Msg);
		}
	}
	
	return NULL;
}

BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
{
	if(dwReason == DLL_PROCESS_ATTACH)
	{
		CreateThread(NULL, NULL,
			PatchMW3_Console, NULL, NULL, NULL);
	}
	
	return TRUE;
}
xVIRUZx , cann't give me the source code dll or a console application with this code?
Quote Originally Posted by densim12 View Post
xVIRUZx , cann't give me the source code dll or a console application with this code?
What do you mean?
If you compile this code, you will get a .DLL file(if your Visual Studio project is configured proplery, ofcourse)
That error is out of for ((void) (*) () addr) ();
Quote Originally Posted by densim12 View Post
That error is out of for ((void) (*) () addr) ();
it just ant c/p
Quote Originally Posted by ASFeld View Post
it just ant c/p
Nope. That's a valid call.
Well actually,
Code:
((void(*)())addr)();
Quote Originally Posted by NR | Prodigi View Post
((LRESULT(__cdecl*)())addr)();
Code:
__declspec(noreturn)
Does that mean anything to you?
I welcome you to call that from your main thread though.
Could someone say me the Kick/Ban command?
Quote Originally Posted by xImShiftZ View Post
Could someone say me the Kick/Ban command?
Code:
kick < PlayerName >
kickclient < Client Number >
ban < PlayerName >
banclient < Client NUmber >
Yeah.
I mean this could you say me that?
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?