2

I have built an app that can count the time.

After two hours its says "please stop playing or I will shut down the computer". So, my brother can stop the process from the "Windows Task Manager". Is it possible to stop it? So he can't kill it form there?

I have tried to reopen the app when the windows forms close - any other ways?

Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
Alon M
  • 1,583
  • 7
  • 30
  • 44

5 Answers5

3

Haha, good on your brother. He is a hacker in the making.

You need to run the process with administrator privileges and make sure his login dosent have administrator privileges.

Tom Squires
  • 8,848
  • 12
  • 46
  • 72
  • 1) Great way, any guild on how i am doing my process as a adminitrator privieaages? thanks. 2) any other way you know? thanks again!:) – Alon M Aug 31 '11 at 08:52
  • 1) depends how your app is getting launched. If its from scheduled tasks then there is a security option. 2) Nothing thats not stupidly complicated – Tom Squires Aug 31 '11 at 08:57
2

Maybe using a Service is a better approach, because it is harder to find in the task manager and it should automatically restart if "killed", but as long as the user has administrator rights he is always able to disable such things.

See THIS WALKTHROUGH on how to create a service with C#.

Christoph Fink
  • 22,727
  • 9
  • 68
  • 113
2

Perhaps slight over-kill (and not easily possible in C#), but you could instead write a DLL that implements the timer, and inject it into another process (e.g. Explorer.exe), which means that it won't appear as a separate process in Task Manager, and so won't be possible to kill in that way.

Iridium
  • 23,323
  • 6
  • 52
  • 74
2

I probably shouldn't mention this as it can be easy to abuse, but knowledge needs to be free, right?

If you run your process as the SYSTEM user, then it cannot be shut down, even by anyone logged in as Administrator. Quite simply, you use psexec from Sysinternals to run your process, check this blog post for details: How to: Run a cmd under system account / gain access to system account

slugster
  • 49,403
  • 14
  • 95
  • 145
  • This depends on the operating system - on XP, even processes running as SYSTEM can be killed by an administrative user. – Iridium Aug 31 '11 at 09:28
1

I'm afraid this is not possible in general. As long as the user has administrative rights he can kill any process.

I would suggest to implement and run your application as a windows service. An administrator can stop the service as well. But users without administrative rights are not allowed to do so.

Stephan
  • 4,187
  • 1
  • 21
  • 33