Пример #1
0
        private IntPtr GetPointer(Process program, string asmName)
        {
            if (string.IsNullOrEmpty(asmName))
            {
                Searcher.MemoryFilter = delegate(MemInfo info) {
                    return((info.State & 0x1000) != 0 && (info.Protect & 0x40) != 0 && (info.Protect & 0x100) == 0);
                };
            }
            else
            {
                Tuple <IntPtr, IntPtr> range = ProgramPointer.GetAddressRange(program, asmName);
                Searcher.MemoryFilter = delegate(MemInfo info) {
                    return((ulong)info.BaseAddress >= (ulong)range.Item1 && (ulong)info.BaseAddress <= (ulong)range.Item2 && (info.State & 0x1000) != 0 && (info.Protect & 0x20) != 0 && (info.Protect & 0x100) == 0);
                };
            }

            BasePtr = Searcher.FindSignature(program, Signature);
            if (BasePtr != IntPtr.Zero)
            {
                LastVerified = DateTime.Now.AddSeconds(5);
                int offset = CalculateRelative(program);
                return(BasePtr + offset);
            }
            return(BasePtr);
        }
Пример #2
0
        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));
            }
        }