Retour Function
I've been working on learning about Detours and such lately cuz i wanna learn more about hacking and D3D and i came across something called "retour functions"
i didn't read it all yet, but i'll post what i learned from it. This may be useless for now on CA, but maybe in the future it will be useful
Main.h
Main.cpp
i didn't read it all yet, but i'll post what i learned from it. This may be useless for now on CA, but maybe in the future it will be useful
Main.h
Code:
bool RetourFunc(BYTE *src, BYTE *restore, const int len);
Main.cpp
Code:
bool RetourFunc(BYTE *src, BYTE *restore, const int len)
{
DWORD dwback;
if(!VirtualProtect(src, len, PAGE_READWRITE, &dwback)) { return false; }
if(!memcpy(src, restore, len)) { return false; }
restore[0] = 0xE9;
*(DWORD*)(restore+1) = (DWORD)(src - restore) - 5;
if(!VirtualProtect(src, len, dwback, &dwback)) { return false; }
return true;
}


