How to write an unkillable process for Windows?

后端 未结 10 1202
梦如初夏
梦如初夏 2021-01-15 12:56

I\'m looking for a way to write an application. I use Visual C++ 6.0.

I need to prevent the user from closing this process via task manager.

10条回答
  •  盖世英雄少女心
    2021-01-15 13:36

    I just stumbled upon this post while trying to find a solution to my own (unintentional) unkillable process problem. Maybe my problem will be your solution.

    1. Use jboss Web Native to install a service that will run a batch file (modify service.bat so that it invokes your own batch file)
    2. In your own batch file, invoke a java process that performs whatever task you'd like to persist
    3. Start the service. If you view the process in process explorer, the resulting tree will look like:

    jbosssvc.exe -> cmd.exe -> java.exe

    1. use taskkill from an administrative command prompt to kill cmd.exe. Jbosssvc.exe will terminate, and java.exe will be be an orphaned running process that (as far as I can tell) can't be killed. So far, I've tried with Taskmanager, process explorer (running as admin), and taskkill to no avail.

    Disclaimer: There are very few instances where doing this is a good idea, as everyone else has said.

提交回复
热议问题