Prevent an application from being closed by the user through the task manager

4

I have a C # application that can not be closed by the user. But even if I eliminate all means of closing the application, including by itself, it is still possible to terminate the process by the task manager. Can you stop this? Is it possible to remove the application from the task manager?

    
asked by anonymous 24.02.2015 / 14:28

2 answers

9

In general this is not possible , especially for a code in your application. The application itself has no control over this.

The most that is possible is not giving the process ( TERMINATE ) the privilege to shut down when you install the program. But this does not totally solve. Thankfully no software can do this.

The user can prevent the software from running automatically on the next startup and it will definitely kill your program. So it's not even worth the effort.

If he knows what he's doing, it's possible to give the privilege on his own without having to give a boot on the machine. There are specialized software that kill processes that can not be killed. Microsoft's Process Explorer can help you do this.

Certainly there are some possible devices like capturing NtTerminateProcess in kernel or creating another program that is monitoring this principal. But no trick is effective . Worse, you think you're protected when you're not.

Forget this idea.

    
24.02.2015 / 14:47
0

The solution I found was to check the processes and if the user opened the task manager I would close it. I made a Thread for this purpose.

        public void antiGerenciadorDeTarefas() {
            while (true) {
                Process[] processos = Process.GetProcesses();
                foreach (Process processo in processos) {

                    if (processo.ProcessName.Equals("Taskmgr")) {
                        processo.Kill();
                    }
                }
                Thread.Sleep(1000);
            }

        }
    
24.02.2015 / 21:09