所以我有一个代码可以让我写入进程的内存,但我想在我要写入的地址中添加一个偏移量。我有一个名为'IGI'的游戏的基本指针,但它有一个偏移量,而且我仍然坚持在目前为止添加一个偏移量。
以下是我写给内存的方式:
public static void WriteMem(Process p, int address, long v)
{
var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
var val = new byte[] { (byte)v };
int wtf = 0;
WriteProcessMemory(hProc, new IntPtr(address), val, (UInt32)val.LongLength, out wtf);
CloseHandle(hProc);
}
我坚持在这里添加'144'的偏移量:
private void button1_Click(object sender, EventArgs e)
{
var p = Process.GetProcessesByName("IGI").FirstOrDefault();
WriteMem(p, 0xD85878, 99);
}
答案 0 :(得分:0)
您可以使用memorySharp库
// address to edit
var address = new IntPtr(0x001D7AB4);
// Open process with MemorySharp
using (var m = new MemorySharp(Process.GetCurrentProcess()))
{
// Edit address
m[address].WriteString("write something in hex offset of memory location");
}