예제 #1
0
파일: PatchManager.cpp 프로젝트: Cyrre/d2bs
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;
}
예제 #2
0
파일: ItemViewer.cpp 프로젝트: perryh/Devil
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);
}