All pastes #373443 Raw Edit

Stuff

public cpp v1 · immutable
#373443 ·published 2007-02-26 20:06 UTC
rendered paste body
bool CDetour::Remove(BYTE *orig, BYTE *jmp, int iPatchType, int len){	int iMinLen = 0;	DWORD dwBack = 0;	// Get minimum bytes to overwrite	if(iPatchType == DETOUR_TYPE_OBS_RAND)		iPatchType = (rand() % (DetourRandTypeHigh - DetourRandTypeLow + 1) + DetourRandTypeLow);	if(!(iMinLen = GetDetourLen(iPatchType)))		return false;	if(len != 0 && len < iMinLen)		return false;	// Try and find the end of the instruction automatically	if(len == 0)	{		len = GetDetourLenAuto(jmp, iMinLen);		if(len < iMinLen)			return false;	}	// Write the bytes @ the jmp back to the orig	VirtualProtect(orig, len, PAGE_READWRITE, &dwBack);	memcpy(orig, jmp, len);	VirtualProtect(orig, len, dwBack, &dwBack);	return true;}