使应用程序/服务尝试在任务管理器中结束/终止其进程将导致“无法终止进程". [英] Making an app/service such that trying to end/kill its process in Task Manager would result in "Unable to Terminate Process"

查看:71
本文介绍了使应用程序/服务尝试在任务管理器中结束/终止其进程将导致“无法终止进程".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Avast 防病毒软件,它有一个进程AvastSvc.exe".如果我尝试在 Windows 任务管理器中结束/终止该进程,则会出现一个带有以下消息的窗口:无法终止进程"、操作无法完成."、访问被拒绝".尝试结束某些系统 Windows 进程(如 winlogon.exe)可能具有相同的行为(尽管一旦我设法杀死 winlogon.exe 并让我的机器挂起!).

I have an Avast antivirus and it has a process "AvastSvc.exe". If I try to end/kill that process in Windows Task Manager, then a windows with the following messages appears: "Unable to Terminate Process", "The operation could not be completed.", "Access is denied". Trying to end some system Windows processes (like winlogon.exe) may feature the same behaviour (although once I managed to kill winlogon.exe and got my machine hanged!).

我希望我的应用程序(可能转换为服务)以相同的方式运行.我该怎么做?

I want my application (possibly, converted to a service) behave in the same way. How can I do this?

禁用 Windows 任务管理器,这样他就不能杀死我的process 是一个类似的问题,有很多有趣的答案,但它们似乎没有采用上述防病毒软件使用的技术,并导致无法终止进程"消息.

Disable Windows Task Manager so he cant kill my process is a similar question which has many interesting answers, but they don't seem to feature the technique which is used by the above antivirus and results in "Unable to Terminate Process" message.

http://forums.codeguru.com/showthread.php?t=503337 有一个关于如何防止停止服务的解决方案(例如,通过 services.msc 控制台),但我需要在任务管理器中防止结束/终止它的进程.

http://forums.codeguru.com/showthread.php?t=503337 has a solution on how to prevent stopping a service (eg, via services.msc console), but I need preventing ending/killing its process in Task Manager.

我在 Windows 7 下用 C++/winapi 编写应用程序,没有 CLR/.Net.

I am writing the app in C++/winapi, no CLR/.Net, under Windows 7.

权限更新:防病毒进程 AvastSvc.exe 归系统"帐户所有.但是,我有系统"帐户拥有的其他进程,它们是可杀死的,而防病毒软件则不是.另外,我比较了杀毒进程和可杀进程的可执行权限和所有者,我没有看到任何区别.

UPDATE on permissions: Antivirus process AvastSvc.exe is owned by "system" account. However, I have other processes owned by "system" account, and they are killable and antivirus is not. Also, I compared executable permissions and owners of antivirus process and ones of killable processes, and I don't see any difference.

关于用户控制和软件用途的更新:软件功能介于系统和业务软件之间.软件的性质要求它永久运行.应用程序本身会有一个关闭"操作,我们希望鼓励用户使用它并阻止他们杀死进程(这类似于防病毒软件所做的).我知道不可能完全阻止用户杀死它,但我想让它变得更难.这个问题特别关于上述方法(无法终止进程"),某些服务(如 Avast)使用该方法来防止终止其进程.对我来说,实现相同的行为就足够了.此外,如果用户不喜欢/不再需要它,则可以卸载该软件.

UPDATE on user control and purpose of the software: The software functionality is somewhere between that of system and business software. The nature of the software requires it to run on a permanent basis. The application itself will have a "turn off" action, and we want to encourage users to use it and discourage them from killing the process (it's similar to what antiviruses do). I understand that it's not possible to completely prevent users from killing it, but I want to make it harder. This question is specifically about the way described above ("Unable to Terminate Process") which some services (like Avast) use to prevent killing their processes. It is sufficient for me to achieve just the same behavior. Also, users will be able to just uninstall the software if they don't like it/don't need it anymore.

推荐答案

我发现 防止用户进程被结束进程"杀死来自 Process Explorer 的结果正是我想要的效果.

I found that the function ProtectProcess() supplied in Prevent user process from being killed with "End Process" from Process Explorer results exactly in the effect I was looking for.

这篇关于使应用程序/服务尝试在任务管理器中结束/终止其进程将导致“无法终止进程".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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