What is the best way to kill a critical process?
-
It's critical for a reason so you probably shouldn't be killing it at all. The best way is to shut down the box lest you leave it in a dangerous state.
If you choose to ignore my warning, here is some sample C++ code to do it.
ixo : Ok. Well thank you for the life lesson. However, if I NEEDED to kill a system process, how would I do so.paxdiablo : Sorry, ixo, didn't mean to sound condescending, added a link for you.ixo : Oh no, you did not sound condescending. You were just being quite logical and using reasoning :) Thank you for the link kind sir.Paul Betts : Killing a critical system process means that the machine is pretty much hosed and can't do anything (i.e. can't authenticate users, can't create remote threads, etc). Don't do this. -
Invoking the kill function in signal.h is one way to killing a process in C. No idea about the alternations in C++.
Edit : Have a look on this code.
ixo : Thank you, I love the link btw! (bookmarked) What would be the best way via Windows API?strager : This looks like POSIX, not Windows. -
with a wrench
in the library
-
This knowledge base article describes how to do it. You first call
SeDebugPrivilege()to obtain the privileges to terminate processes, then you callOpenProcess()with thePROCESS_TERMINATEflag to get a handle to the process you wish to terminate, and then finally you callTerminateProcess()to terminate the process. -
Yup, do what Adam suggested. Then watch as your machine bluescreens since you just terminated a critical process :) (btw, to be clear: Adam's suggestion is 100% accurate, it's not my intent to criticize it at all).
Why do you want to do this? There's a reason they're called critical processes.
1800 INFORMATION : I recall one day I had a services control panel that was stuck so I decided to kill it from task manager - hmm what could the name be I asked myself - obviously it must be services.exe1800 INFORMATION : In case you are wondering, no it isn't and the machine bluescreened
0 comments:
Post a Comment