Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#指针偏移量>;255-ProcessMemoryReader_C#_Pointers_Offset_Readprocessmemory - Fatal编程技术网

C#指针偏移量>;255-ProcessMemoryReader

C#指针偏移量>;255-ProcessMemoryReader,c#,pointers,offset,readprocessmemory,C#,Pointers,Offset,Readprocessmemory,我知道有很多教程向您展示了如何使用“ProcessMemoryReader”函数。但这个问题似乎是独一无二的,或者尚未解决 很长一段时间以来,我一直在深入研究其他人的代码,以找到一种使用多个偏移量的方法。 我认为使用多个偏移量对我来说是个问题,但我认为这是一个问题,因为我的偏移量值大于255 我试图从中获取内存值的游戏叫做“攻击立方体”。 由于我不确定是否得到了正确的偏移量值,我用谷歌搜索了其他人的结果。 它们似乎完全一样: (如果未安装作弊引擎,则可以使用记事本查看.ct文件。) 这是我的代码

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

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

我试图从中获取内存值的游戏叫做“攻击立方体”。 由于我不确定是否得到了正确的偏移量值,我用谷歌搜索了其他人的结果。 它们似乎完全一样: (如果未安装作弊引擎,则可以使用记事本查看.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会有问题。

使用FindDMAAddy为您遍历指针链,下面是一个工作示例,请确保以管理员身份运行:

public static IntPtr FindDMAAddy(IntPtr hProc、IntPtr ptr、int[]偏移量)
{
var buffer=新字节[IntPtr.Size];
foreach(偏移量中的整数i)
{
ReadProcessMemory(hProc、ptr、buffer、buffer.Length、out
变量读取);
ptr=(IntPtr.Size==4)?IntPtr.Add(新的IntPtr(BitConverter.ToInt32(缓冲区,0)),i):ptr=IntPtr.Add(新的IntPtr(BitConverter.ToInt64(缓冲区,0)),i);
}
返回ptr;
}
var modBase=GetModuleBaseAddress(proc.Id,“ac_client.exe”);
var ammoAddr=FindDMAAddy(hProc,(IntPtr)(modBase+0x10f4f4),新的int[]{0x374,0x14,0});
Console.WriteLine(“Ammo地址”+“0x”+ammoAddr.ToString(“X”);
int newAmmo=1337;
字节[]缓冲区=新字节[4];
ReadProcessMemory(进程句柄、ammoAddr、缓冲区、4、输出);
WriteLine(“Ammo value”+BitConverter.ToInt32(缓冲区,0.ToString());
WriteProcessMemory(hProc、ammoAddr、NEWAMO、4、out);
ReadProcessMemory()没有这样的限制。在第二个代码段中,您正在读取指向整数的指针。这很简单。在第一个代码段中,您正在读取指向整数的指针。这并不是那么简单。一个小错误,你就会读垃圾。