C#:字节数组的搜索地址,例如CheatEngine

时间:2019-05-10 21:05:21

标签: c# arrays search memory byte

我想在另一个过程存储器中获取字节数组的地址。

我试图在进程内存中搜索字节数组的地址,但是程序CheatEngine立即执行此操作会花费很多时间(超过10分钟)。 https://i.imgur.com/5Lj5OdM.png

        Process process = Process.GetProcessesByName("witcher")[0];
        IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);

        uint PTR = 0x0DEB0000; //begin of memory
        byte[] bitSearch = { 0xA8, 0x04, 0x10, 0x00 }; //your bit array until ??
        byte[] buff = new byte[bitSearch.Length];
        int bytesRead = 0;
        while (PTR != 0xFF000000)   //end of memory // u can specify to read less if u know he does not fill it all
        {
            ReadProcessMemory((int)processHandle, (int)PTR, buff, buff.Length, ref bytesRead);
            Console.WriteLine(BitConverter.ToString(buff));
            if (buff== bitSearch)
            {
                Console.WriteLine(PTR);
            }

            PTR += 0x1;
        }
        Console.ReadLine();

为什么这么久?

0 个答案:

没有答案