0

I have an application that will only stop/start services if it is run as an Administrator.

Is it possible to stop/start services from an application that is running as a normal user? Surely it is? I have tried all different combinations of access flags in my ::OpenService() call but I cannot get a valid handle. If I use SERVICE_INTERROGATE I get a valid handle returned but then I can't call ::ControlService() to stop/start the service. If I specify SERVICE_PAUSE_CONTROL, I receive a NULL handle.

I do actually own the service application. Is there something I need to do to the service application itself to alter the security requirements?

Update: I have found that I can use the code below to change the security settings for my service. The only problem now is that I need to tell if the specific user name. Does anybody know if there is a way that BuildExplicitAccessWithName() can grant access to ALL users?

BuildExplicitAccessWithName(&ea, TEXT("GUEST"), SERVICE_START | SERVICE_STOP | READ_CONTROL | DELETE, SET_ACCESS, NO_INHERITANCE);

Cheers Paul

SparkyNZ
  • 6,266
  • 7
  • 39
  • 80
  • Possibly related: [Start / Stop a Windows Service from a non-Administrator user account](http://stackoverflow.com/questions/4436558/start-stop-a-windows-service-from-a-non-administrator-user-account) – Daniel Pryden Jul 19 '11 at 21:29
  • Thanks. Unfortunately it didn't help as it was more concerned with changing the actual user's account settings. – SparkyNZ Jul 19 '11 at 23:16
  • What values are you passing to `OpenSCManager()`? – Remy Lebeau Jul 20 '11 at 00:45

1 Answers1

0

All sorted - I used "Everyone" and this did the job.

SparkyNZ
  • 6,266
  • 7
  • 39
  • 80