-1

I am trying To kill The Process "cheatengine-i386.exe" But I Get Error "Access Denied" .

    private void Form1_Load(object sender, EventArgs e)
    {
        Process[] runningProcesses = Process.GetProcesses();
        foreach (Process process in runningProcesses)
        {
            // now check the modules of the process
            foreach (ProcessModule module in process.Modules)
            {
                if (module.FileName.Equals("cheatengine-i386.exe"))
                {
                    process.Kill();
                }
            }
        }
    }
}

}

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Ahmed Ehab
  • 15
  • 1
  • 6
  • 4
    Are you an administrator on the machine? – Bearcat9425 Aug 20 '13 at 20:08
  • Might want to check [this](http://stackoverflow.com/questions/3486996/process-kill-denied-in-windows-7-32bits-even-with-administrator-privileges) out. And if by chance you are trying to kill processes on a remote machine, `Process.Kill` is incapable of doing that. – gitsitgo Aug 20 '13 at 20:30

2 Answers2

1

Your program where you are trying to kill cheatengine-i386.exe is not running with enough privileges to kill the other process. You probably need to run your program as an administrator.

BlargleMonster
  • 1,602
  • 2
  • 18
  • 33
0

The program certainly changed its ACL to prevent itself from being killed. Logically speaking, the solution it to change its ACL back, but you can't do that in managed code at all, and dealing with locked-out ACL objects is so painful in native code I let pre-written programs do it for me.

Joshua
  • 40,822
  • 8
  • 72
  • 132