我想编辑代码GetProcessesByName

时间:2018-08-26 16:54:45

标签: c#

我希望在这里的任何人都可以通过我在网上玩的游戏中的教练中使用的这段代码来帮助我...这段代码很好用,但在Clint中只有一种,并且该游戏我们比Clint开得更多,我想玩这段代码希望所有Clint都能参加该游戏..希望您能理解我的意思..谢谢

private void nyX_CheckBox1_CheckedChanged(object sender)
    {
        if (nyX_CheckBox1.Checked == true)
        {
            Process pp = Process.GetProcessesByName("Game.exe")[0];
            IntPtr handle = OpenProcess(0x1F0FFF, false, pp.Id);
            int written = 0;
            // make like ths
            byte[] write = { 0x00, 0x00 };
            //MildFz is smexy
            WriteProcessMemory((int)handle, 0x00, write, write.Length, ref written);
        }
        else if (nyX_CheckBox1.Checked == false)
        {
            Process pp = Process.GetProcessesByName("Game.exe")[0];
            IntPtr handle = OpenProcess(0x1F0FFF, false, pp.Id);
            int written = 0;
            // make like ths
            byte[] write = {0x00, 0x00};
            //MildFz is smexy
            WriteProcessMemory((int)handle, 0x00, write, write.Length, ref written);
        }
    }

1 个答案:

答案 0 :(得分:1)

如果您要在一个系统上运行多个游戏实例,并想将此代码应用于所有实例,则应遍历所有游戏进程。您的代码应更改为:

    Process[] pp = Process.GetProcessesByName("Game.exe");
    foreach (Process process in pp)
    {
        IntPtr handle = OpenProcess(0x1F0FFF, false, process.Id);
        int written = 0;
        // make like ths
        byte[] write = { 0x00, 0x00 };
        //MildFz is smexy
        WriteProcessMemory((int)handle, 0x00, write, write.Length, ref written);
    }