Search code examples
c#killaccess-denied

Killing Process "cheatengine-i386.exe"


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();
                }
            }
        }
    }
}

}


Solution

  • 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.