1

I have a C# application that is used to capture users screen, this application will be installed using an installer that requires administrator permissions. the application itself needs an active user session but doesn't display any UI elements of its own. My question how to make sure that the application is running whenever a user logs in? and how to make sure that no user (with no admin permission) can close the application?

The application should run on windows XP, 7, 8.

Yazan Jaber
  • 2,068
  • 25
  • 36

2 Answers2

2

You can install the application so that it starts with every start of windows. You can use the registry for that or the (default user) startup folder.

An user without admin rights will not be able to kill an application that is not his, so if you start the application using i.e. the local system account, he won't be able to kill it. He will not even be able to see it, because the function "show processes from all users" in task manager is limited to users with admin permissions.

Disclaimer: Be aware that under certain legislations, it might be illegal to install such an application in a company network without the users knowing about it.

PMF
  • 14,535
  • 3
  • 23
  • 49
  • "so if you start the application using i.e. the local system account", how can I specify that? Also, can you give me pointers to the registry solution and about the "default user startup folder". – Yazan Jaber Jan 18 '14 at 14:04
  • Actually, these are separate questions. They have answers elsewhere, i.e. for the startup, see [this question](http://stackoverflow.com/questions/5894607/how-to-automatically-start-application) or others. To start an application using the local system account, you would probably best install your application as a service. That also solves the first problem. – PMF Jan 18 '14 at 14:43
  • To create a service [this answer](http://stackoverflow.com/questions/7579184/starting-a-service) could come in handy. Or read the MSDN on creating services using C#. – PMF Jan 18 '14 at 14:47
  • If I create the application as a service I wouldn't be able to interact directly with the user desktop (necessary for screen capture) – Yazan Jaber Jan 18 '14 at 14:50
  • Hmm... that's probably true. You'd probably need a stub-loader to execute your application with permissions from another user, then. I haven't used that before. – PMF Jan 18 '14 at 14:52
-1

Use the Task Scheduler. It can launch apps at user logon with elevated privileges. Otherwise if it does not have to be a foreground App use a Windows service.

Daniel C
  • 1,332
  • 9
  • 15