keron
asked on
How to prevent a Process from being killed in task list?
in 98 I can hide the process
be in NT/2000,it seemed not so easy
how can I prevent my soft to be closed in NT/2000?
be in NT/2000,it seemed not so easy
how can I prevent my soft to be closed in NT/2000?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'd have to go with danysz idea...
OnClose will not even be called if you choose your apps-process in the processlist in the Task Manager and click End Process.
This way of shutting down the process is using the Windows API TerminateProcess and it just pull the plug on your process. The process that are beeing killed doesn't have a chance to do any cleaning up or even to respond.
The only way to stop some one from killing your process is to make it a service and give authorization to a specific user to end it... Perhaps you could authorize only the SYSTEM accout to kill the service...
//Mikael
OnClose will not even be called if you choose your apps-process in the processlist in the Task Manager and click End Process.
This way of shutting down the process is using the Windows API TerminateProcess and it just pull the plug on your process. The process that are beeing killed doesn't have a chance to do any cleaning up or even to respond.
The only way to stop some one from killing your process is to make it a service and give authorization to a specific user to end it... Perhaps you could authorize only the SYSTEM accout to kill the service...
//Mikael
hi mikael
thanks
yes u can do it..
but the best think is to make it available just for specific user even not for SYSTEM if u want t have it real protected. in this case u just have to add him a function to catch shut down of windows to shut down yourself...
also to be sure that the message is not faked ( send from somebody just to your application ) u shall make your service to wake before some critical services and also check that other critical services are depending on you and they are going down too...
also u can take for example service like browser that is looking for server and to put your service between ....
browser is looking for you and your are starting only after server ....
daniel
thanks
yes u can do it..
but the best think is to make it available just for specific user even not for SYSTEM if u want t have it real protected. in this case u just have to add him a function to catch shut down of windows to shut down yourself...
also to be sure that the message is not faked ( send from somebody just to your application ) u shall make your service to wake before some critical services and also check that other critical services are depending on you and they are going down too...
also u can take for example service like browser that is looking for server and to put your service between ....
browser is looking for you and your are starting only after server ....
daniel
I wasn't sure if that would work from a Task Manager kill or not. Thanks for the info!
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Please accept danysz's comment as answer.
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Robert Marquardt
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Please accept danysz's comment as answer.
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Robert Marquardt
EE Cleanup Volunteer
procedure TForm1.Form1Close(Sender: TObject, var Action: TCloseAction);
begin
Action := caNone;
end;
You may want to put some logic around that, so when you really do want the program to close, it will. :)