Join Date: May 2012
Posts: 13
|
Danke SilverFire, aber bei mir crasht das Spiel (egal welches Dx9 Game), wenn ich die Funktion im HookThread aufrufe. Code:
HookThread:
SpoilerCPP Code: DWORD WINAPI HookThread(void) { while(!hModule) { hModule = GetModuleHandle ("d3d9.dll"); Sleep(200); } dwGlobal = dwFindPattern((DWORD)hModule, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx"); memcpy(&VTableStart, (void*)(dwGlobal+2), 4); pEndScene = ( EndScene_t )HookVTable( (DWORD**) dwGlobal, 42, (PBYTE) hkEndScene); return 0; }
HookVTable:
SpoilerCPP Code: PBYTE HookVTable(DWORD** VTablePtr, int VTableIndex, PBYTE HookPtr) { DWORD oldProtect; VirtualProtect((void*)((*VTablePtr)+(VTableIndex*sizeof(DWORD))),sizeof(DWORD),PAGE_EXECUTE_READWRITE,&oldProtect); PBYTE original=((BYTE*)(*VTablePtr)[VTableIndex]); (*VTablePtr)[VTableIndex]=(DWORD)HookPtr; VirtualProtect((void*)((*VTablePtr)+(VTableIndex*sizeof(DWORD))),sizeof(DWORD),oldProtect,&oldProtect); return original; }
|