Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, May 4, 2012 5:11 AM
Hi,
I am developing a windows application which should not be killed by user any how. I have hide this from Application tab (In Task manager) but do not have any idea that "How to hide a process from task manager using C#".
Currently user can close the application process by Task Manager & End Task.
Actually I want either that process should be hide for current user or task manager should not be accessible until the application is not filled up.
Is it possible using karnel.dll or using other dlls with dllImport functionality? if yes then how?
Rakesh Kumar, Zensar technologies Ltd
All replies (21)
Thursday, May 24, 2012 3:40 AM âś…Answered
Hi Michael,
As per discussion on this forum and others, it is like policy violation of hiding the process from task manager and No body should implement it. I am leaving this as it is. I will not make the process as hide, it will be shown to the user and user can kill that process if he really required.
Still I am sure that there should be some other way to hide the process and we dont know that logic. That logic might be used in low level programming.
Any way, I will close this question now. I have some other questions posted in other forum related to task manager
Rakesh Kumar, Zensar technologies Ltd
Friday, May 4, 2012 6:08 AM | 2 votes
Hi, read is here: http://stackoverflow.com/questions/187983/how-do-i-hide-a-process-in-task-manager-in-c
Mitja
Friday, May 4, 2012 6:21 AM
I agree this is for intranet scenario, If I were using this application - I would still kill this process without it being present on taskmanager! There are other tools and ways to go about it, so I would recommend we think away from disabling the process in TM or disable TM itself. Lets delve to your root problem :) I think this is against the best practice!
Friday, May 4, 2012 6:31 AM
My aim is stop the user to kill application using task manager. after filling the application, he can close the application using application exit button but should not close using task manager + end task.
Rakesh Kumar, Zensar technologies Ltd
Friday, May 4, 2012 7:10 AM | 1 vote
This is not possible because it can raise a security theft to the operating system. I am not sure if using Kernel32.DLL this can be done but I will not recommend you of this approach as it are against security best practices you can refer: http://blogs.msdn.com/b/oldnewthing/archive/2004/02/16/73780.aspx
Lingaraj Mishra
Friday, May 4, 2012 7:15 AM | 1 vote
This involves writing some low level code to achieve this (Which is also error prone). I suggest that instead of not displaying the process inside the Taskmanager, just remove the privilages to open the TaskManager itself. This can be done by just tweaking some registy entries.
I hope this helps.
Please mark this post as answer if it solved your problem. Happy Programming!
Friday, May 4, 2012 7:23 AM
This can not be done as few users does not have admin rights. and for modifying registry, admin rights are required.
Rakesh Kumar, Zensar technologies Ltd
Wednesday, May 9, 2012 12:23 PM
Hi,
Firstly, hiding the process from TaskManager may lead to malicious codes. Such a scenario is not recommended to support in forum, please see http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/dd4c2e57-ba8b-476c-8f39-38bf623e64ff
Besides, I don't think it's easy to hide the process from TaskManager. Or if you need to prevent TaskManager killing the process, you need some native hook which is not C# can accomplish. The Stackoverflow forum thread whic Mitja suggested is very helpful, http://stackoverflow.com/questions/187983/how-do-i-hide-a-process-in-task-manager-in-c
So, I would recommend you change the design.
Good day!
Thanks
Michael Sun [MSFT]
MSDN Community Support | Feedback to us
Wednesday, May 9, 2012 12:47 PM
do this job is so hard.because you must write your code in kernel mode to hook Information that transfers on windows kernel.
but you can simply create a Windows Service.and hide your program without any trouble.
Wednesday, May 9, 2012 1:41 PM
you can do provide multiple process, which on close one call another.., and don't let each other down...
Wednesday, May 9, 2012 1:51 PM
deadman, please read the first link that Michael Sun posted above. You should not be contributing answers that have a high probability of being used maliciously.
Wednesday, May 9, 2012 1:59 PM
OP, you cannot do what you want. You cannot stop an admin from terminating a process irrelevant of what you do. It just isn't supported. An admin has privileges to do anything and everything. Even if you could stop them what purpose would it serve? If you were creating some auto-start app that you never wanted terminated then an admin could simply modify the appropriate entries to prevent your app from starting. Alternatively they could use redirection to prevent your app from ever starting.
Even Windows had this problem up until Vista or so. Prior to that you could kill system processes that would almost immediately BSOD your machine. Starting with Vista (I believe) they put special code in the kernel API for process termination to prevent the termination of a select few apps. Short of that you simply cannot prevent an admin from terminating a process.
Michael Taylor - 5/9/2012
http://msmvps.com/blogs/p3net
Thursday, May 10, 2012 3:57 AM
it's true that a person can write a virus or such, but even though the user should have knowledge of any thing... it's no good to limit user from knowing, it's good if users they self respect people and programming rule and stop writing such, with limiting them, closing their eyes and ears we wont find the peace, i say because I'm from such a country
I also see viruses, which when i look closely, i saw them as protector, till a virus, but for it's user, yeah it's virus for other people, for example the one hide folders and make a shortcut to them...
Thursday, May 10, 2012 4:00 AM
I'm sure windows even have a lockup over registers, and memory, so I'm wonder if we change them and windows don't restore them...
Thursday, May 10, 2012 4:03 AM
Whether you agree with it or not it's the policy of these forums to not contribute answers that are likely to be used maliciously, especially if there are few to no legitimate uses for such answers. This case fits those criteria almost exactly. There are almost no legitimate reasons to prevent a user from being able to close a program, and it's a requirement for almost all malicious programs that they not be easy to disable.
Unless you're writing operating system processes of some sort, or an anti-virus software, there really isn't any need for you to make a program that can't ever be killed. Virtually every other case can be handled through proper use of the operating system security/permissions structure.
Thursday, May 10, 2012 2:02 PM
ok, as a rule i accept it :|
but still, some time there's a need that a user not be able to close your application directly, for example, my PC is such public park, every one go and come, there's lot of thing they do, and i don't care, but some time they do something i get mad :|
you may say, so create a new user for them , but i have my own reason ...
Thursday, May 10, 2012 2:38 PM
ok, as a rule i accept it :|
but still, some time there's a need that a user not be able to close your application directly, for example, my PC is such public park, every one go and come, there's lot of thing they do, and i don't care, but some time they do something i get mad :|
you may say, so create a new user for them , but i have my own reason ...
You should create a new user for them. That is the solution to that problem.
If you know how to make an unkillable program and want to put it on your own machine I'm not going to stop you, but if you suggest giving someone else the code to make an unkillable program because they're saying they want to let some stranger use their computer without being able to kill some program then I would tell you that's wrong and you shouldn't do it because you have no way of knowing they aren't planning to use it maliciously, and you have no way of preventing other users finding the thread on the net and using the code maliciously.
Friday, May 11, 2012 5:48 PM
there's nothing unkillable, always anti viruses come with a new defence, for those who are a threat, but it's their job, we pay for our protection...
a process that has no way to exist normally should be detected by antivirus, but some process are like what i said, but still there's a out going way for manual exiting
Friday, May 11, 2012 6:00 PM
In my last post when I said "unkillable" I actually mean "extraordinarily hard to kill, and can't be killed by many, most, or all conventional means". As has already been said, unless you're an OS process there is some way some how to kill a process if you're an admin user.
Thursday, May 24, 2012 1:38 AM
Hi Rakesh,
So, how's the problem now? I believe we have made the point very clear. The short answer is we cannot hide a process from task manager using C#. Do you have any other questions?
Good day!
Thanks
Michael Sun [MSFT]
MSDN Community Support | Feedback to us
Thursday, May 24, 2012 3:43 AM
Thanks Rakesh!
Michael Sun [MSFT]
MSDN Community Support | Feedback to us