function changes the configuration parameters of a service.
| SC_HANDLE hService,
||// handle to service
| DWORD dwServiceType,
||// type of service
| DWORD dwStartType,
||// when to start service
| DWORD dwErrorControl,
||// severity if service fails to start
| LPCTSTR lpBinaryPathName,
||// pointer to service binary file name
| LPCTSTR lpLoadOrderGroup,
||// pointer to load ordering group name
| LPDWORD lpdwTagId,
||// pointer to variable to get tag identifier
| LPCTSTR lpDependencies,
||// pointer to array of dependency names
| LPCTSTR lpServiceStartName,
||// pointer to account name of service
| LPCTSTR lpPassword,
||// pointer to password for service account
| LPCTSTR lpDisplayName
||// pointer to display name
Identifies the service. This handle is returned by the OpenService
function and must have SERVICE_CHANGE_CONFIG access.
A set of bit flags that specify the type of service. Specify SERVICE_NO_CHANGE
if you are not changing the existing service type; otherwise, specify one of
the following service type flags to indicate the service type. In addition, if
you specify either of the SERVICE_WIN32 flags, you can also specify the
SERVICE_INTERACTIVE_PROCESS flag to enable the service process to interact with the
||A service type flag that specifies a Win32 service that runs in its own
||A service type flag that specifies a Win32 service that shares a process with
||A service type flag that specifies a Windows NT device driver.
||A service type flag that specifies a Windows NT file system driver.
||A flag that enables a Win32 service process to interact with the desktop.
Specifies when to start the service. This value can be the service type
SERVICE_NO_CHANGE if the existing start type is not modified, or one of the following
values can be specified:
||Specifies a device driver started by the operating system loader. This value
is valid only if the service type is SERVICE_KERNEL_DRIVER or
||Specifies a device driver started by the IoInitSystem function. This value is valid only if the service type is
SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER.
||Specifies a device driver or Win32 service started by the service control
manager automatically during system startup.
||Specifies a device driver or Win32 service started by the service control
manager when a process calls the StartService function.
||Specifies a device driver or Win32 service that can no longer be started.
Specifies the severity of the error if this service fails to start during
startup, and determines the action taken by the startup program if failure occurs.
One of the following values can be specified:
||The startup (boot) program logs the error but continues the startup operation.
||The startup program logs the error and puts up a message box pop-up but
continues the startup operation.
||The startup program logs the error. If the last-known-good configuration is
being started, the startup operation continues. Otherwise, the system is
restarted with the last-known-good configuration.
||The startup program logs the error, if possible. If the last-known-good
configuration is being started, the startup operation fails. Otherwise, the system is
restarted with the last-known good configuration.
||The existing StartType value is not to be changed.
Pointer to a null-terminated string that contains the fully qualified path to
the service binary file. If the pointer is NULL, the path is not modified.
Pointer to a null-terminated string that names the load ordering group of
which this service is a member. If the pointer is NULL, the group is not modified.
If it points to an empty string, the service does not belong to a group.
The registry has a list of load ordering groups located at
The startup program uses this list to load groups of services in a specified
order with respect to the other groups in the list. You can place a service in a
group so that another service can depend on the group.
The order in which a service starts is determined by the following criteria:
- The order of groups in the registry's load-ordering group list. Services in
groups in the load-ordering group list are started first, followed by services in
groups not in the load-ordering group list, and then services that do not
belong to a group.
- The service's dependencies listed in the lpDependencies parameter and the dependencies of other services dependent on the service.
Pointer to a 32-bit variable that receives a unique tag value for this service
in the group specified in the lpLoadOrderGroup
parameter. If no tag is requested, this parameter can be NULL.
You can use a tag for ordering service startup within a load ordering group by
specifying a tag order vector in the registry located at
Tags are only evaluated for SERVICE_KERNEL_DRIVER and
SERVICE_FILE_SYSTEM_DRIVER type services that have SERVICE_BOOT_START or SERVICE_SYSTEM_START start
Pointer to an array of null-separated names of services or load ordering
groups that must start before this service. The array is double null-terminated. If
the pointer is NULL, the dependencies are not modified. If it points to an
empty string, the service has no dependencies. If a group name is specified, it
must be prefixed by the SC_GROUP_IDENTIFIER character (defined in the WINSVC.H
files) to differentiate it from a service name, because services and service
groups share the same name space. Dependency on a service means that this service
can only run if the service it depends on is running. Dependency on a group means
that this service can run if at least one member of the group is running after
an attempt to start all members of the group.
Pointer to a null-terminated string. If NULL is specified, the name is not
modified. If the service type is SERVICE_WIN32_OWN_PROCESS, this name is the
account name in the form of "DomainName\Username", which the service process will be
logged on as when it runs. If the account belongs to the built-in domain,
".\Username" can be specified. Services of type SERVICE_WIN32_SHARE_PROCESS are not
allowed to specify an account other than LocalSystem.
If the service type is SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER,
this name is the Windows NT driver object name (that is, \FileSystem\Rdr or
\Driver\Xns), which the input and output (I/O) system uses to load the device
driver. If NULL is specified, the driver is run with a default object name created by
the I/O system, based on the service name.
Pointer to a null-terminated string that contains the password to the account
name specified by the lpServiceStartName
parameter if the service type is SERVICE_WIN32_OWN_PROCESS or
SERVICE_WIN32_SHARE_PROCESS. If the pointer is NULL, the password is not modified. If it
points to an empty string, the service has no password. If the service type is
SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER, this parameter is ignored.
Pointer to a null-terminated string that is to be used by user interface
programs to identify the service. This string has a maximum length of 256
characters. The name is case-preserved in the Service Control Manager. Display name
comparisons are always case-insensitive.
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 following error codes may be set by the service control manager. Other
error codes may be set by the registry functions that are called by the service
||The specified handle was not opened with SERVICE_CHANGE_CONFIG access.
||A circular service dependency was specified.
||The display name already exists in the service controller's database, either
as a service name or as another display name.
||The specified handle is invalid.
||A parameter that was specified is invalid.
||The account name does not exist, or a service is specified to share the same
binary file as an already installed service but with an account name that is not
the same as the installed service.
||The service has been marked for deletion.
function changes the configuration information for the specified service in
the service control manager database. This configuration information is
initially specified by the CreateService
function and can be queried (except for the password parameter) by using the QueryServiceConfig
Any of the configuration parameters specified for this function can be left
unchanged by specifying NULL for a string parameter or SERVICE_NO_CHANGE for a
If the configuration is changed for a service that is running, with the
exception of lpDisplayName
, the changes do not take effect until the service is stopped.
- Software for developers
Software for Android Developers
- More information resources
Unix Manual Pages
- Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database