0

I have my own custom windows Service which I wish that every user either admin or non admin should be able to start/Stop or Query Status and its start up type. I am using ServiceManager to do this in C++ and it returns NULL on OpenService() if I am running in Non Admin mode. I want the handle to Service even in Non Admin mode.

I searched out over internet and could get that its not a good idea to allow non admins to change/Start or Stop services but i need to do this. I either don't want to make it complex to change the DACL of the Service as everything is perfectly working except this Admin and Non admin thing. There fore I wish for a simpler solution to make OpenService to return a Handle though the user is not an Admin.

Here is what I am trying to do

schService = OpenService(schSCManager, MyServicename, SERVICE_QUERY_STATUS | SERVICE_START);

The above statement returns NULL for Non admins and I don't wanna do that. Is there any other access modes that I can get for my requirement?

Thanks,

Programmerzzz
  • 1,237
  • 21
  • 48
  • There is no way to allow non-admin users to start the service without changing the DACL. But it isn't complicated to do so, only about a dozen lines of code. See http://stackoverflow.com/a/8380009/886887. Note that the default permissions already allow non-admin users to query the service status. – Harry Johnston Feb 07 '15 at 08:41
  • possible duplicate of [Start Windows Service From Application without Admin right(c++)](http://stackoverflow.com/questions/8379697/start-windows-service-from-application-without-admin-rightc) – Harry Johnston Feb 07 '15 at 08:43

0 Answers0