Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using ProcessMemoryReaderAndWriterlib;
- using System.Diagnostics;
- namespace Test_meomry_pointer
- {
- public partial class Form1 : Form
- {
- ProcessMemoryReaderAndWriter api = new ProcessMemoryReaderAndWriter();
- Process GameProcess = null;
- int pointerMemoryAddr = -1;
- int bytesout;
- int bytesWritten;
- public Form1()
- {
- InitializeComponent();
- }
- private void comboBox1_Click(object sender, EventArgs e)
- {
- foreach(var proc in Process.GetProcesses())
- {
- comboBox1.Items.Add(proc.ProcessName + "-" + proc.Id);
- }
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- foreach(var proc in Process.GetProcesses())
- {
- if(comboBox1.Text.Contains(proc.ProcessName) && comboBox1.Text.Contains(proc.Id.ToString()))
- {
- GameProcess = proc;
- timerOfSetup.Start();
- }
- }
- }
- //base: "programme test.exe"+00001374
- //offset: 0
- private void setup()
- {
- IntPtr pointerAdd = new IntPtr(0x00001374);
- api.ReadProcess = GameProcess;
- api.OpenProcess();
- ProcessModule pModule = null;
- foreach (ProcessModule module in GameProcess.Modules)
- {
- if (module.FileName.Contains("programme test.exe"))
- {
- pModule = module;
- }
- }
- pointerMemoryAddr = api.ReadPointerAddress(pointerAdd, 0x0, 4, out bytesout, true, (int)pModule.BaseAddress);
- }
- private void timerOfSetup_Tick(object sender, EventArgs e)
- {
- setup();
- timerOfSetup.Stop();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (pointerMemoryAddr != -1 && txtAmount.Text != string.Empty)
- {
- api.WriteMemory((IntPtr)pointerMemoryAddr, BitConverter.GetBytes(int.Parse(txtAmount.Text)), out bytesWritten);
- }
- }catch(Exception ex) { MessageBox.Show(ex.Message); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement