I am using CreateService
to installs a Windows Service executable however I can't seem to find out how to set the description for the service.
Does anyone know how to do this?
Thanks.
Service descriptions are kept in the registry under LocalMachine\System\CurrentControlSet\services and then open the key for your service name, one of the keys is Description which holds the description text. Change that and restart the computer.
A Windows service is a long-running application that can be started automatically when your system is started. You can pause your service and resume or even restart it if need be. Once you have created a Windows service, you can install it in your system using the InstallUtil.exe command line utility.
Call ChangeServiceConfig2
passing SERVICE_CONFIG_DESCRIPTION
as the dwInfoLevel
parameter. You will also need a handle to the service, but CreateService
gives you one of those.
SERVICE_DESCRIPTION description = { L"The service description" };
ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &description);
Have a look at this MSDN page for an example. You use the ChangeServiceConfig2
method.
SERVICE_DESCRIPTION sd;
SC_HANDLE schService;
SC_HANDLE schSCManager;
// Not shown: Get a handle to the SCM database.
// Not shown: Get a handle to the service.
sd.lpDescription = TEXT("Description");
ChangeServiceConfig2( schService, // handle to service
SERVICE_CONFIG_DESCRIPTION, // change: description
&sd) ) // new description
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With