public IntPtr GetPointer(Process program) { if (program == null) { Pointer = IntPtr.Zero; lastID = -1; return(Pointer); } else if (program.Id != lastID) { Pointer = IntPtr.Zero; lastID = program.Id; } if (Pointer != IntPtr.Zero && !searcher.VerifySignature(program, lastPointer, lastSignature)) { Pointer = IntPtr.Zero; } if (Pointer == IntPtr.Zero && DateTime.Now > lastTry) { lastTry = DateTime.Now.AddSeconds(1); Pointer = GetVersionedFunctionPointer(program); if (Pointer != IntPtr.Zero) { if (AutoDeref != AutoDeref.None) { if (MemoryReader.is64Bit) { Pointer = (IntPtr)program.Read <ulong>(Pointer); } else { Pointer = (IntPtr)program.Read <uint>(Pointer); } if (AutoDeref == AutoDeref.Double) { if (MemoryReader.is64Bit) { Pointer = (IntPtr)program.Read <ulong>(Pointer); } else { Pointer = (IntPtr)program.Read <uint>(Pointer); } } } } } return(Pointer); }
public bool VerifyPointer(Process program) { DateTime now = DateTime.Now; if (now > LastVerified) { bool isValid = Searcher.VerifySignature(program, BasePtr, Signature); LastVerified = now.AddSeconds(5); if (!isValid) { BasePtr = IntPtr.Zero; return(false); } } return(true); }