C ++ Jump Hooks

Eh bien, je veux en savoir plus sur le hooking, mais il semble que les tutoriels trouvés sur Internet ne fonctionneront pas.

Ce que je veux faire est un hook, en C ++.

Voici le code:

void DoHook(DWORD* Address, DWORD* Hook, DWORD pid){ HANDLE Server = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ , false, pid ); Address = (DWORD*)Address + 0x18; DWORD OldProt; DWORD HookOffset = (DWORD*)Hook-(DWORD*)Address-5; std::wcout << "Hook on address" << std::hex << Address<< std::endl; std::wcout << "Hook offset is " << std::hex << HookOffset < 0 ) { x = HookOffset & 0xff; newdata[5-i] = x; i++; HookOffset >>= 8; } std::wcout << "Bytes " <<newdata[0] << " " << newdata[1] << " " << newdata[2] << " " << newdata[3] << " " << newdata[4] << std::endl; DWORD newdatasize = sizeof(newdata); if ( ! WriteProcessMemory(Server,Address,(LPCVOID*)newdata,newdatasize,NULL) ) { ErrorExit(L"WriteProcessMemory"); } // VirtualProtect((void*) Address, 40, 0x40, &OldProt); return; } 

Voici un texte de sortie:

 Process ID is 2764 // PID of the app that's being hooked Function address is 00A81190 // this is the function i'm doing the jump to Entry point is 00080000 // for the app that's being hooked Hook on address 00080060 // for the app that's being hooked Hook offset is 28048e // HookAddress - FunctionAddress - 5 Bytes e9 0 28 4 8e // this is the jump i'm planning to do Press any key to continue . . . 

Cependant, l’application ne se met pas à jour.