Esempio n. 1
0
 public bool ProcessFilter(Process p)
 {
     try
     {
         var hdl = MemoryReader.OpenProcess(MemoryReader.ProcessAccessFlags.QueryLimitedInformation, false, p.Id);
         if (hdl == IntPtr.Zero)
         {
             return(false);
         }
         if (!Environment.Is64BitOperatingSystem)
         {
             return(true);
         }
         IsWow64Process(hdl, out bool rv);
         MemoryReader.CloseHandle(hdl);
         return(rv == !Environment.Is64BitProcess);
     }
     catch (Win32Exception)
     {
         return(false);
     }
     catch (InvalidOperationException)
     {
         return(false);
     }
 }
Esempio n. 2
0
        private void bt_load_table_Click(object sender, System.EventArgs e)
        {
            if (_mMemory != null)
            {
                _mMemory.CloseHandle();
            }
            string file = "Test.CT";

            _mMemoryList = new CheatEngineReader();
            _mMemoryList.Read(file);

            lbl_table.Text = "Table:" + file;

            // Update UI.
            _mTable.Items.Clear();

            // Search for the exe
            Process[] p = Process.GetProcessesByName(_mMemoryList.ProcessExe.Substring(0, _mMemoryList.ProcessExe.Length - 4));
            if (p.Length == 1)
            {
                _mProcess            = p[0];
                _mMemory             = new MemoryReader();
                _mMemory.ReadProcess = p[0];
                _mMemory.OpenProcess();

                lbl_exe.Text = "PID:" + p[0].Id + "\r\n[" + p[0].ProcessName + "]";
            }
            else if (p.Length == 0)
            {
                lbl_exe.Text = "Failed";
                MessageBox.Show("Please load only if the process is already running.");
                // TODO: Wait for process.
                return;
            }
            else
            {
                lbl_exe.Text = "Failed";
                MessageBox.Show("Found multiple exe's running! Cannot figure out what to-do.");
                //TODO: Add dialog.
                return;
            }

            IntPtr base_addr = p[0].MainModule.BaseAddress;

            for (int i = 0; i < _mMemoryList.Channels.Count; i++)
            {
                _mMemoryList.Channels[i].UI_ID   = i;
                _mMemoryList.Channels[i].Address = new IntPtr(_mMemoryList.Channels[i].Address.ToInt32() + base_addr.ToInt32());
                MemoryChannel ch = _mMemoryList.Channels[i];
                _mTable.Items.Add(new ListViewItem(new string[5]
                {
                    ch.ID.ToString(),
                    ch.Name,
                    "0x" + String.Format("{0,10:X}", ch.Address.ToInt32()),
                    ch.TypeToString(),
                    "0.000"
                }));
            }


            _mGrabber       = new Grabber(_mMemoryList, _mMemory);
            _mGrabber.Done += new Signal(_mGrabber_Done);
        }