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; }