All pastes #373627 Raw Edit

Mine

public cpp v1 · immutable
#373627 ·published 2007-02-26 22:07 UTC
rendered paste body
bool CDetour::BackupFunction( BYTE* func, int len ){	MEMORY_BASIC_INFORMATION mbi;	bool bRet = false;	VirtualQuery( ( void* )func, &mbi, sizeof( mbi ) );	VirtualProtect( mbi.BaseAddress, mbi.RegionSize, PAGE_EXECUTE_READWRITE, &mbi.Protect );	memcpy( ( void* )bBackup, ( void* )func, len );	if( ( BYTE )bBackup[0] == *( BYTE* )func )	{		bRet = true;	}else{		bRet = false;	}	VirtualProtect( mbi.BaseAddress, mbi.RegionSize, mbi.Protect, &mbi.Protect );	FlushInstructionCache( GetCurrentProcess( ), ( void* )func, len );	return bRet;}