Platform SDK: DLLs, Processes, and Threads |
The ChangeServiceConfig2 function changes the optional configuration parameters of a service.
BOOL ChangeServiceConfig2( SC_HANDLE hService, // handle to service DWORD dwInfoLevel, // information level LPVOID lpInfo // new data );
If one of the specified service controller actions is SC_ACTION_RESTART, hService must have the SERVICE_START access right.
Value | Meaning |
---|---|
SERVICE_CONFIG_DESCRIPTION | The lpInfo parameter is a pointer to a SERVICE_DESCRIPTION structure. |
SERVICE_CONFIG_FAILURE_ACTIONS | The lpInfo parameter is a pointer to a SERVICE_FAILURE_ACTIONS structure. |
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The ChangeServiceConfig2 function changes the optional configuration information for the specified service in the service control manager database. You can obtain the current optional configuration information by using the QueryServiceConfig2 function.
You cannot set the SERVICE_CONFIG_FAILURE_ACTIONS value for a service that shares the service control manager's process. This includes all services whose executable image is "services.exe".
You can change and query additional configuration information using the ChangeServiceConfig and QueryServiceConfig functions, respectively.
Windows NT/2000: Requires Windows 2000.
Header: Declared in Winsvc.h; include Windows.h.
Library: Use Advapi32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows 2000.
Services Overview, Service Functions, ChangeServiceConfig, CreateService, OpenService, QueryServiceConfig, QueryServiceConfig2, SERVICE_DESCRIPTION, SERVICE_FAILURE_ACTIONS