Пример #1
0
        public static int ScanPattern(string mModuleName, string mPattern, int Offset = 0, int Extra = 0, bool ModuleSubract = false)
        {
            IntPtr        hProcess       = m_iProcess.Handle;
            ProcessModule SelectedModule = null;

            foreach (ProcessModule module in m_iProcess.Modules)
            {
                if (Path.GetFileName(module.FileName) == mModuleName)
                {
                    SelectedModule = module;
                }
            }
            if (SelectedModule == null)
            {
                throw new Exception("Selected Module is Null !");
            }
            var scanner = new SigScan(hProcess);

            scanner.SelectModule(SelectedModule.BaseAddress, SelectedModule.ModuleMemorySize);
            int Scaned = (int)scanner.FindPattern(mPattern, out long time);

            if (Scaned != 0)
            {
                var Scan = BitConverter.ToInt32(Read(Scaned + Offset, 4), 0) + Extra;
                if (ModuleSubract)
                {
                    Scan -= (Int32)SelectedModule.BaseAddress;
                }
                return(Scan);
            }
            else
            {
                return(0);
            }
        }
Пример #2
0
        public Patcher(Process fnProcess)
        {
            _fnProcess = fnProcess;
            _fnHandle  = Win32.OpenProcess(Win32.PROCESS_ALL_ACCESS, false, _fnProcess.Id);
            _sigScan   = new SigScan(_fnHandle);

            _sigScan.SelectModule(_fnProcess.MainModule);

            PrefetchAddresses();
        }