Example #1
0
bool PatchManager::InstallPatches(void)
{
	for(int x = 0; x < arraySize(pHooks); x++)
	{
		DWORD Offset = PointerManager::Instance()->GetDllOffset(pHooks[x].dwDllNo, pHooks[x].dwAddr);
		pHooks[x].dwAddr = Offset;
		pHooks[x].bOldCode = new BYTE[pHooks[x].dwLen];
		if(::ReadProcessMemory(GetCurrentProcess(), (void*)Offset, pHooks[x].bOldCode, pHooks[x].dwLen, NULL) == 0) {
			printf("ReadProcessMemory: Offset='%#08X' Err'%d'\n", Offset, GetLastError());
			return false;
		}

		// Need better handling
		if(pHooks[x].Type == CALL)
			PatchCall(Offset, pHooks[x].dwFunc, pHooks[x].dwLen);
		else if(pHooks[x].Type == JMP)
			PatchJmp(Offset, pHooks[x].dwFunc, pHooks[x].dwLen);

	}
	return true;
}
Example #2
0
void InstallPatches() {
	PatchCall((DWORD)((DWORD)LoadLibrary("D2Client.dll")+0xAF242),(DWORD)ViewInventoryPatch1_ASM,6);
	PatchCall((DWORD)((DWORD)LoadLibrary("D2Client.dll")+0xAE914),(DWORD)ViewInventoryPatch2_ASM,6);
	PatchCall((DWORD)((DWORD)LoadLibrary("D2Client.dll")+0xAD93F),(DWORD)ViewInventoryPatch3_ASM,5);
}