Ejemplo n.º 1
0
        public void VerifyPointer(Process program, ref IntPtr pointer)
        {
            DateTime now = DateTime.Now;

            if (now <= LastVerified)
            {
                return;
            }

            bool isValid = Searcher.VerifySignature(program, BasePtr, Signature);

            LastVerified = now.AddSeconds(1);
            if (isValid)
            {
                int    offset = CalculateRelative(program);
                IntPtr verify = ProgramPointer.DerefPointer(program, BasePtr + offset, AutoDeref);
                if (verify != pointer)
                {
                    pointer = verify;
                }
                return;
            }

            BasePtr = IntPtr.Zero;
            pointer = IntPtr.Zero;
        }
        public IntPtr FindPointer(Process program, string asmName)
        {
            if (string.IsNullOrEmpty(asmName)) {
                BasePtr = program.MainModule.BaseAddress;
            } else {
                Tuple<IntPtr, IntPtr> range = ProgramPointer.GetAddressRange(program, asmName);
                BasePtr = range.Item1;
            }

            if (Offsets.Length > 1) {
                LastVerified = DateTime.Now.AddSeconds(5);
                return ProgramPointer.DerefPointer(program, program.Read<IntPtr>(BasePtr, Offsets), AutoDeref);
            } else {
                LastVerified = DateTime.MaxValue;
                BasePtr += Offsets[0];
                return ProgramPointer.DerefPointer(program, BasePtr, AutoDeref);
            }
        }
 public IntPtr FindPointer(Process program, string asmName)
 {
     return ProgramPointer.DerefPointer(program, GetPointer(program, asmName), AutoDeref);
 }