C# 指针偏移 > 255 - ProcessMemoryReader

标签 c# pointers offset readprocessmemory

我知道有很多教程向您展示如何使用“ProcessMemoryReader”函数。但这个问题似乎是独特的或尚未解决。

很长一段时间以来,我一直在深入研究其他人的代码以找到使用多个偏移量的方法。 而且我认为使用多个偏移量对我来说是个问题,但我认为这是一个问题,因为我的偏移量值大于 255。

我试图从中获取内存值的游戏称为“Assault Cube”。 因为我不确定我是否得到了正确的偏移值,所以我在谷歌上搜索了其他人的结果。 它们看起来完全一样: http://cheatengine.org/tables/moreinfo.php?tid=1142 (如果没有安装金手指可以用记事本查看.ct文件。)

这是我的代码,使用 ProcessMemoryReader.cs

private void timer1_Tick(object sender, EventArgs e)
{
int bytesread;
int pointerbase;
byte[] memory;
Process[] myprocess = Process.GetProcessesByName("ac_client");
if (myprocess.Length != 0)
{
preader.ReadProcess = myprocess[0];
preader.OpenProcess();

//Ammo
memory = preader.ReadProcessMemory((IntPtr)0x4DF73C, 4, out bytesread);
pointerbase = BitConverter.ToInt32(memory, 0);
pointerbase += 0x00; //0 // 14 // 378

byte[] memory1 = preader.ReadProcessMemory((IntPtr)pointerbase, 4, out bytesread);
int pointerbase1 = BitConverter.ToInt32(memory1, 0);
pointerbase1 += 0x14; //0 // 14 // 378

byte[] memory2 = preader.ReadProcessMemory((IntPtr)pointerbase1, 4, out bytesread);
int pointerbase2 = BitConverter.ToInt32(memory2, 0);
pointerbase2 += 0x378; //00 // 14 // 378

byte[] memory3 = preader.ReadProcessMemory((IntPtr)pointerbase2, 4, out bytesread);
int valueis = BitConverter.ToInt32(memory3, 0);
label1.Text = valueis.ToString();
}

尽管使用单个指针,该过程工作正常,例如:

 //HP
 memory = preader.ReadProcessMemory((IntPtr)0x4DF73C, 4, out bytesread);
 pointerbase = BitConverter.ToInt32(memory, 0);
 pointerbase += 0xf4;

 byte[] memory1 = preader.ReadProcessMemory((IntPtr)pointerbase, 4, out bytesread);
 int valueis = BitConverter.ToInt32(memory1, 0);
 label2.Text = valueis.ToString();

这很有效,这里发生的事情非常简单,但我不知道如何读取具有多个偏移量的 Ammo 代码。

最佳答案

我不熟悉 CheatEngine 及其表格格式,但我不觉得它指向您正在使用的内存地址。

您在 0x4DF73C 处读取了 4 个字节,它用作下一次读取的新内存地址。重复几次。基本上,您是从一个指针到另一个指针的指针读取信息。您确定这是预期的吗?

没有任何理由认为大于 255 的偏移值会成为问题。

关于C# 指针偏移 > 255 - ProcessMemoryReader,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16046171/

相关文章:

c# - 使用动态字段名称使用 LINQ 查询实体

c - char * 指针可以指向什么(是不是像 void *)?

c - 将指针传递给函数并在函数结束时打印其值

r - glm 起始值不被接受日志链接

php - 检查 DST 是否有效

c# - .NET 服务系统.Net.Sockets.SocketException : 'No such host is known'

c# - 正确使用类?

c# - 将焦点从一个控件切换到另一个控件

C++:用于超重对象的方便的基于指针数组的值迭代器

MySQL天前基于其他表中的设置