Window services application deployments

Good day administrator

Please I'm learning how to register and deploy application in window service by writing c++ code.

I'm currently trying to deploy dns service BIND9, which it ocours that i must register the application as a services in window operating system before i will be able to use it.

I'm wondering if i will be able to write c++ code manually to register it as a services.

Thanks in advance.
Last edited on
The Win32 API has functions to manage system services, including functions to create a new service.

See here:
* https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-createservicew
* https://docs.microsoft.com/en-us/windows/win32/services/installing-a-service

Note: Your process probably needs to run with elevated rights in order to be able to register a new service.

NoteĀ²: Be aware that you can not register arbitrary programs as a system service in Windows. In order to be able to run as a system service, the program (executable file) must be written in a particular way!

Example:
https://www.codeproject.com/Articles/499465/Simple-Windows-Service-in-Cplusplus

(most programs that are intended to run as a service should come with some sort of facility to install the service. For example, a command-line switch like "--install-service" or "--remove-service")
Last edited on
srvany can be used to run a .exe program as a service
Topic archived. No new replies allowed.