0

We are developing a software for a hosting company. This software is required to Lock/Unlock computers based on whether the admin is physically present or not.

We are using RFID. So as long as the software detects admin's RFID, the system remains unlocked. As soon as the Admin leaves the premises, the software automatically locks the computer. Untill the admin again enters the premises.

The main problem in getting this to work is, the application needs to run at all time and no one should be able to close the application.

Even if it shows up in task manager, the main purpose is the no one should be able to close the application.

spender
  • 117,338
  • 33
  • 229
  • 351
Dr. Sahib
  • 156
  • 10
  • 3
    Make it a service, it won't appear in task manager. – atoMerz Apr 03 '14 at 18:10
  • 1
    @atoMerz Services do appear – Sriram Sakthivel Apr 03 '14 at 18:11
  • 2
    @SriramSakthivel True enough, but a user still won't be able to kill it without sufficient privileges, which is the real goal here. – Servy Apr 03 '14 at 18:12
  • 2
    @SriramSakthivel They do if you click the "Show processes from all users" button/checkbox. And it requires administrative access. Granted, I think that only works on OSes with UAC enabled. – Steven V Apr 03 '14 at 18:12
  • Agree with you guys, but I think user can go to services tab to see the service am not sure whether he'll be in a position to stop it. – Sriram Sakthivel Apr 03 '14 at 18:18
  • Don't do it in C#. Do it using the Native Windows APIs without involving another runtime that can be shut down. – George Stocker Apr 03 '14 at 18:20
  • @GeorgeStocker Could you expand a bit on it? any process can be killed rite? Am not sure I understand you. – Sriram Sakthivel Apr 03 '14 at 18:24
  • 1
    It's a game of cat and mouse; there's no way to do it in C#; but you could try doing it in C++ using the Win32 API. http://blogs.msdn.com/b/oldnewthing/archive/2004/02/16/73780.aspx – George Stocker Apr 03 '14 at 18:27

1 Answers1

1

The short answer is: you cannot prevent a running process from being stopped by a power user. At best you can make it hard, but never impossible.

Besides, you shouldn't ever design a software thinking it won't ever be interrupted. If it's a critical process, then you have to design it in a way so that it can recover if it ever stops abruptly. After all, no matter how much protection you wrap it in, it won't resist a power outage anyway. :)

Crono
  • 10,211
  • 6
  • 43
  • 75
  • -1 Go and try to kill "avast" for instance! Even a administrator can't kill it. – Sriram Sakthivel Apr 03 '14 at 18:25
  • @SriramSakthivel I do not know avast but I'm sure it can be stopped. – Crono Apr 03 '14 at 18:26
  • 1
    @SriramSakthivel Avast isn't written in C#. – George Stocker Apr 03 '14 at 18:26
  • No dude, you'll get `access denied message`. – Sriram Sakthivel Apr 03 '14 at 18:27
  • @GeorgeStocker It is not about c# or vb.Net it is about hooking up the `TerminateWindow` api of `kernel32.dll`. which you can do it in c# also – Sriram Sakthivel Apr 03 '14 at 18:28
  • 2
    @SriramSakthivel The fact that you get access denied message when trying to kill the process via task manager doesn't make the process kill-proof, which is basically what the OP asks for. If a lower-level process manages to prevent itself to be killed from TM, another lower-level process may just be able to. So my answer stand: you CANNOT prevent a process from being killed, be it from TM or anywhere else. – Crono Apr 03 '14 at 18:40