【发布时间】:2013-10-05 02:28:16
【问题描述】:
我正在使用:ProcessMemoryReaderLib.dll 将它引用到我的项目中。 这是form1代码:
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 System.Diagnostics;
using ProcessMemoryReaderLib;
using System.IO;
namespace ProcessMemory
{
public partial class Form1 : Form
{
ProcessMemoryReader pReader;
int store;
IntPtr score_addr;
byte[] write;
public Form1()
{
InitializeComponent();
for (int i = 0 ; i < 2; i++)
{
store = 0;
pReader = new ProcessMemoryReader(); //create a new writer - reader
Process[] hProcessSnap; //create an array containing all running processes
Process hProcess = null;
hProcessSnap = Process.GetProcesses(); //Load all processes in the array
// The address
score_addr = (IntPtr)00000005;//(IntPtr)0x1007800;
write = new byte[4];
write = BitConverter.GetBytes(0);
for (int n = 0; n < hProcessSnap.Length; n++)
{
// ProcessName is not Unique, there could be many matching processes
// and this loop will only return the last one.
if (hProcessSnap[n].ProcessName == "FlashPlayerPlugin_11_8_800_168")
hProcess = hProcessSnap[n];
}
pReader.ReadProcess = hProcess;
pReader.OpenProcess();
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
pReader.WriteProcessMemory(score_addr, write, out store);
}
}
}
我添加了自己的 for 循环。
一般的想法是在其内存中的特定进程中找到特定值。
例如: score_addr = (IntPtr)00000005;
00000005 = 5 十六进制
现在我在特定进程内存中的内存中找到了许多具有此值的位置。 现在我要对流程进行更改,在里面做一些更改,流程是一个程序,所以我改变我想要的值,如果它是 5 现在它是 4
所以现在我将在进程内存中搜索值 4。所以它是 5 现在它是 4 结果应该很窄,例如进程内存中只有 3-4 个位置将是 4。
现在我想将这 3-4 个地址的值分别更改为 8。 所以现在如果我查看我的程序(进程),我会看到值已更改为 8。
- 扫描内存中的进程名。
- 使用特定值(例如 5)定位进程内存中的所有位置/地址。
- 转到进程/程序更改那里的东西,所以现在值 5 是 4。
- 从内存中的最后一个位置再次扫描值 4,找到值 4 的所有位置/地址。
- 值 4 的所有结果的更改将每个内存地址的值更改为值例如 8。
- 写回这个值 4 的结果的确切位置,现在它的值已更改为 8。
因此,如果我现在查看我的流程,它现在将显示值 8。
我该怎么做?
【问题讨论】: