简体   繁体   English

确保强制应用程序连续运行的方法(覆盖taskkill,任务管理器等)

[英]Guaranteed way to force application running continuously (overriding taskkill, task manager etc.)

I have a C# security/monitoring application that I need to have running no matter what. 无论如何,我都有一个需要运行的C#安全/监视应用程序。 However, I can not remove privileges or restrict access to parts of the OS (Windows). 但是,我不能删除特权或限制对OS(Windows)部件的访问。

I thought of having a protection service running which monitors continuously if an application is running, and starts it back up when the application is killed somehow, while the application monitors the protection service and starts the service if the service is killed. 我考虑过运行一个保护服务,该服务会连续监视是否正在运行某个应用程序,并在应用程序以某种方式被杀死时将其启动,而该应用程序会监视保护服务并在该服务被杀死时启动该服务。 To my knowledge you can't simultaneously kill multiple processes at the same time. 据我所知,您不能同时杀死多个进程。

Any better idea to guarantee that an application is always running? 有什么更好的主意来保证应用程序始终运行?

The Windows team gets requests like this all the time: Windows团队一直在收到这样的请求:

"I want to make a process that can never be killed". “我想制定一个永远无法终止的进程”。

"Well I want to make a tool that can kill any process". “好吧, 想做一个可以杀死任何进程的工具”。

One of those two people is going to be disappointed. 这两个人中的一个会失望的。

"I want to make a window that is always on top of all other windows no matter what" “无论如何,我都希望创建一个始终位于所有其他窗口之上的窗口”

"I also want to make a window that is always on top of all other windows no matter what" “无论如何,我希望创建一个始终位于所有其他窗口之上的窗口”

One of those two people is going to be disappointed. 这两个人中的一个会失望的。

"I want to make a process that does not show up in any list of processes no matter how cleverly the listing program is trying to find me" “无论列表程序试图找到我多么聪明,我都希望创建一个不会出现在任何进程列表中的进程”

"I want to make a program that lists all processes, no matter how cleverly the process is trying to hide". “无论程序试图隐藏多么聪明,我都希望创建一个列出所有进程的程序”。

One of those two people is going to be disappointed. 这两个人中的一个会失望的。

And so on. 等等。

I think you're going to be one of the disappointed people. 我认为您将成为失望的人之一。

There is no guarantee - if the user has enough privilege it can terminate your program or any other monitoring code you have running that will restart your application. 无法保证-如果用户具有足够的特权,则它可以终止您的程序或您正在运行的任何其他监视代码,这些代码将重新启动您的应用程序。

Imagine if this were true - every piece of spyware on the planet would be using it. 想象一下,如果这是真的-地球上的每个间谍软件都将使用它。

I would write your program as a windows service - configure it to run automatically on startup, and to restart automatically if it is terminated unexpectedly. 我会将您的程序编写为Windows服务-将其配置为在启动时自动运行,并在程序意外终止时自动重新启动。 You cannot do any better than this since the user must be allowed to control the computer. 您不能做得更好,因为必须允许用户控制计算机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM