c++ - How to protect a process from being killed? -


i've tried protect process in c++ windows, code is:

#include <iostream> #include <aclapi.h> #include <iostream> #include <windows.h> #include <sddl.h> #include <stdio.h>  using namespace std;  bool denyaccess() {     handle hprocess = openprocess(process_all_access, false, getcurrentprocessid());     security_attributes sa;     sa.nlength = sizeof(security_attributes);     sa.binherithandle = false;     setkernelobjectsecurity(hprocess, dacl_security_information, sa.lpsecuritydescriptor);     return true; }  int main() {     while(denyaccess());     return 0; } 

but can kill process task manager! what's wrong ?

windows server uses pair of threads monitor each other enforce licensing of windows server vs windows client. if 1 thread stopped or suspended other thread revives affected thread or starts new thread. threads run in system process. can't kill system process without crashing windows.

so approach inject code system process starts pair of threads , have threads protect each , whatever would've had unkillable process (or have third thread whatever work want). can set threads @ high priority level make sure nothing can target both threads @ same time.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -