Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I want to configure the failure actions for a service I have written in Go. I am following the answer posted at following page: How do I configure failure actions of a Windows service written in Go?

The function call ChangeServiceConfig2 returns "Access is denied." error in my case (when the 2nd parameter is SERVICE_CONFIG_FAILURE_ACTIONS).

I am running as Administrator so I don't understand why this function gives "Access denied" error.

I can use the function ChangeServiceConfig2 to perform other actions (e.g. to set the start type for my service as Automatic Delayed, using 2nd parameter as SERVICE_CONFIG_DELAYED_AUTO_START_INFO).

Has anyone had similar issue when using ChangeServiceConfig2 to set failure actions for a Windows service? What is the solution in that case?

I had already looked at the links you provided, but was unable to solve the problem. I am using CreateService and OpenProcess both with SERVICE_ALL_ACCESS access rights, and they don't give any error. I get "access denied" when I use ChangeServiceConfig2 later for the same service. bvk Oct 31, 2017 at 14:24

as mentioned here: https://groups.google.com/forum/#!topic/microsoft.public.win32.programmer.kernel/_McV5qokCR8

...you need to enable SE_SHUTDOWN_NAME privilege.

Credit goes to Alex Fedotov

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .