Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i prevent my WPF application from getting killed from task manager ?
Please help me out...

Thank U in advance.
Posted

There is no way to do that. But you can attach your application to another process. TO do this you have to change your application type to class library and add this into rundll.exe or any other process like explorer.exe, winlogon.exe.
To know more about it go
http://stackoverflow.com/questions/187983/how-do-i-hide-a-process-in-task-manager-in-c[^]

http://bytes.com/topic/c-sharp/answers/825121-how-can-i-prevent-application-being-ended-task-manager-howto-keep-always-alive[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-Jul-11 17:14pm    
My 5. Tricky stuff. I think for most practical purposes first sentence is the best answer.
--SA
Аslam Iqbal 11-Jul-11 13:18pm    
Thanks. I did that in vb6. I created a dll file and add CLSID of that dll into (somewhere in registry now i forget) and for that when explorer.exe starts my dll file starts too. That did what wanted. But when explorer.exe was terminated my dll was terminated too. Finally I've to say it's possible to execute like add-ons.
You can't. Task Manager sees all, and Task Manager can kill all - at ALL access levels.

You could hide your process, but that would probably require you to to write a kernel-mode driver to intercept calls to NtQuerySystemInformation so that the SystemProcessInformation class can't list your process.

Getting permission to install something like that on a corporate server would be unlikely, and the UAC prevents it from happening on desktop machines.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-Jul-11 17:13pm    
Good information, my 5, but for most practical purpose first sentence is the best answer.
--SA
Make sure that the user is not any kind of administrator - administrators obviously needs to be able to kill any process they want.

Provide access from the logon session to a user with required priviledges to start the process in the logon session. That's something you can do from a service. Here is some info on Window Station Security and Access Rights[^]

Deny the logged on user the PROCESS_TERMINATE permission for the process.
More on process security and access rights here[^].

So basically it can be done ... but it's not entirely trivial :)

[Update]
Csrss.exe is the user-mode portion of the Win32 subsystem; Win32.sys is the kernel-mode portion. Csrss stands for Client/Server Run-Time Subsystem, and is an essential subsystem that must be running at all times. Csrss is responsible for console windows, creating and/or deleting threads, and implementing some portions of the 16-bit virtual MS-DOS environment.

Smss.exe is the session manager subsystem, which is responsible for starting the user session. This process is initiated by the main system thread and is responsible for various activities, including launching the Winlogon and Win32 (Csrss.exe) processes, and setting system variables. After it has launched these processes, it waits for either Winlogon or Csrss to end. If this happens normally, the system shuts down; if it happens unexpectedly, Smss.exe causes the system to stop responding

So stopping them is not a good idea

Best regards
Espen Harlinn
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 10-Jul-11 17:12pm    
This is much more informative answer, my 5. However, basic answers by others are correct -- this is useless. I have heard of some advanced techniques by hiding process from Process Manager and prevent a kill, but what is hidden or protected can be viewed and killed with Sysinternals.
--SA
Espen Harlinn 10-Jul-11 17:45pm    
No - not useless, sometimes you have programs running on kiosks - or a PDU at a plant, where you want to make reasonably sure that the casual user are unable to close the application.
Sergey Alexandrovich Kryukov 11-Jul-11 1:10am    
Agree, a kiosk is a special case which I recommend; it works because the users cannot leave application at all.
--SA
Аslam Iqbal 11-Jul-11 13:24pm    
I don't know why I can terminate csrss.exe or smss.exe in XP. They are not to be terminated. Oh that was not by taskmgr, that was my own taskmanager developed in VB.NET. anybody knows why?
Hi to all,

I am also have same problem.
any one able to help me for this.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900