how to inject code before AC loads

08/24/2013 06:26 Cr4ck3r385#1
Hi guys,i´m having trouble with Xcrap..
What can i do to make my code work before xcrap loads and detects the modification?
VirtualProtections seems not working,even with correct syntax..
Code:
void WriteDWORD(DWORD *adr, int value)
{
	DWORD OldProtection;
	VirtualProtect((LPVOID)adr,0x01,PAGE_READWRITE,&OldProtection);//VirtualProtect((LPVOID)0x004C374F,1,PAGE_READWRITE,&OldProtection); 
	*(DWORD*)(adr) = value;//*(DWORD*)(0x004C374F) = 0x01; 
	VirtualProtect((LPVOID)adr,0x01,OldProtection,&OldProtection);//VirtualProtect((LPVOID)0x004C374F,1,OldProtection,&OldProtection); 
}
Code:
while(1)
	{
		HWND hWnd = FindWindow(0, "Priston Tale"); 

		if(hWnd)
		{
			GetWindowThreadProcessId(hWnd, &proc_id); 
			HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id); 

			if(hProcess)
			{
				WriteDWORD((PDWORD)0x004C374F,0x01);
				WriteDWORD((PDWORD)0x004C37A7,0x01);
				WriteDWORD((PDWORD)0x004C37EC,0x01);
Code works a bit of SECONDS of time and xcrap closes game :mad:
Thank you.
08/24/2013 06:36 +Yazzn#2
To inject a DLL before Anti-Cheat loads you could try to create an injector which creates the games process with CREATE_SUSPENDED flag, injects your DLL to it (to get process handle check out PROCESS_INFORMATION.hProcess) and then resume the process.

P.S.: To write data to memory in a different process you have to use WriteProcessMemory.