通过从任务管理器中删除应用程序进程来阻止我的应用 [英] prevent my application by killing application process from the task manager

查看:114
本文介绍了通过从任务管理器中删除应用程序进程来阻止我的应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是.net程序员,我需要一个soln,我正在创建一个Windows应用程序,我想通过从任务管理器中删除应用程序进程来阻止我的应用程序。就像当我们试图杀死一个Windows进程时,任何人都有任何想法PLZ评论我

i am a .net programmer, i need a soln, am creating a windows application, i want to prevent my application by killing application process from the task manager. Like when we try to kill a windows process, anyone have any idea plz comment me

推荐答案





使用结束进程按钮阻止用户终止进程是不可能的。如果用户使用结束任务按钮,您只能取消关闭您的应用程序:

Hi,

It''s not possible to prevent that a user kills your process using the "End Process" button. You can only cancel that your application will be closed if the user uses the "End Task" button:
public Form1()
{
    InitializeComponent();
    this.FormClosing += Form1_FormClosing;
}
void Form1_FormClosing(object sender, FormClosingEventArgs e)
       {
           if (e.CloseReason == CloseReason.TaskManagerClosing) // if the user tries to closes the process using the "End task" button in task manager, cancel this
           {
               e.Cancel = true;
           }
       }



希望这有帮助。


Hope this helps.


[除了ProgramFOX的正确答案]



我还想解释为什么不可能通过任务管理器阻止应用程序进程被杀死。简而言之,这是因为任务管理器是用户的最后一道防线。



让我们想象一下在操作系统中实现此类功能的一分钟,这在技术上是完全可能的。我们假设这只与应用程序进程有关,在内核环中没有执行任何操作。即使在这种情况下,在用户从不同的介质引导并重新安装操作系统或修改操作系统之前,很容易永远地阻止整个系统的操作。



操作系统的设计方式与应用程序进程无法真正挂起它的方式相同。但是,它仍然可以很好地搞砸操作系统功能;例如,它可以消耗太多的资源,永远不会停止。即使操作系统可能没有挂起,但它实际上 无法使用。它是否意外完成并不重要;系统仍然无法使用。修复它的唯一方法是任务管理器或类似工具,但是你想要阻止它。更糟糕的是,当操作系统启动或用户登录时,您可以轻松地使您的违规过程自动启动。这样,您将完全阻止修复由不良应用程序导致的问题的可能性。这太昂贵了,不允许它发生。



-SA
[In addition to the correct answer by ProgramFOX]

I also want to explain why it''s not possible to prevent the application process from killing through the Task Manager. In brief, this is because Task Manager is the last line of defense for a user.

Let''s imagine for a minute that such feature is implemented in the OS, which would be technically quite possible. Let''s assume this is related to application processes only, nothing executed in the kernel ring. Even in this case, it would be easy to block the operation of the whole system forever, more exactly, until the user boots from a different media and re-install the OS or modifies it.

The OS is designed the way that the application process cannot really hang it. But still, it can screw up the OS functionality pretty well; for example, it can consume too much of resources and never stop. Even though the OS might be not hanging, but it will be practically unusable. And it does not matter if it''s done accidentally or not; the system is still not usable. The only way to fix it would be the Task Manager or similar tool, but you want to prevent it. Worse, you can easily make your offending process auto-started when the OS starts or the user logs in. This way, you would completely block the possibility to fix the problem caused by a bad application. This is too costly to allow it happen.

—SA


这篇关于通过从任务管理器中删除应用程序进程来阻止我的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆