please dont rip this site Prev Next

ChangeServiceConfig info  Overview  Group

The ChangeServiceConfig function changes the configuration parameters of a service.

BOOL ChangeServiceConfig(

    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

   );

Parameters

hService
Identifies the service. This handle is returned by the OpenService or CreateService function and must have SERVICE_CHANGE_CONFIG access.
dwServiceType
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 flags to indicate the service type.

Value

Meaning

SERVICE_WIN32_OWN_PROCESS

Specifies a Win32-based service that runs in its own process.

SERVICE_WIN32_SHARE_PROCESS

Specifies a Win32-based service that shares a process with other services.

SERVICE_KERNEL_DRIVER

Specifies a driver service.

SERVICE_FILE_SYSTEM_DRIVER

Specifies a file system driver service.

If you specify either SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS, you can also specify the following flag.

Value

Meaning

SERVICE_INTERACTIVE_PROCESS

Enables a Win32-based service process to interact with the desktop.

dwStartType
Specifies when to start the service. Specify SERVICE_NO_CHANGE if you are not changing the existing start type; otherwise, specify one of the following flags to indicate the start type.

Value

Meaning

SERVICE_BOOT_START

Specifies a device driver started by the operating system loader. This value is valid only for driver services.

SERVICE_SYSTEM_START

Specifies a device driver started by the IoInitSystem function. This value is valid only for driver services.

SERVICE_AUTO_START

Specifies a service to be started automatically by the service control manager during system startup.

SERVICE_DEMAND_START

Specifies a service to be started by the service control manager when a process calls the StartService function.

SERVICE_DISABLED

Specifies a service that can no longer be started.

dwErrorControl
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. Specify SERVICE_NO_CHANGE if you are not changing the existing error control; otherwise, specify one of the following flags to indicate the error control.

Value

Meaning

SERVICE_ERROR_IGNORE

The startup program logs the error but continues the startup operation.

SERVICE_ERROR_NORMAL

The startup program logs the error and puts up a message box pop-up but continues the startup operation.

SERVICE_ERROR_SEVERE

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.

SERVICE_ERROR_CRITICAL

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.

lpBinaryPathName
Pointer to a null-terminated string that contains the fully qualified path to the service binary file. Specify NULL if you are not changing the existing path.
lpLoadOrderGroup
Pointer to a null-terminated string that names the load ordering group of which this service is a member. Specify NULL if you are not changing the existing group. Specify an empty string if the service does not belong to a group.
lpdwTagId
Pointer to a DWORD variable that receives a tag value that is unique in the group specified in the lpLoadOrderGroup parameter. Specify NULL if you are not changing the existing tag.

You can use a tag for ordering service startup within a load ordering group by specifying a tag order vector in the GroupOrderList value of the following registry key:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control 

Tags are only evaluated for driver services that have SERVICE_BOOT_START or SERVICE_SYSTEM_START start types.

lpDependencies
Pointer to a double null-terminated array of null-separated names of services or load ordering groups that the system must start before this service can be started. (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.) Specify NULL if you are not changing the existing dependencies. Specify an empty string if the service has no dependencies.

You must prefix group names with SC_GROUP_IDENTIFIER so that they can be distinguished from a service name, because services and service groups share the same name space.

lpServiceStartName
Pointer to a null-terminated string that names the service. Specify NULL if you are not changing the existing name. If the service type is SERVICE_WIN32_OWN_PROCESS, use an account name in the form DomainName\UserName. The service process will be logged on as this user. If the account belongs to the built-in domain, you can specify .\UserName. If the service type is SERVICE_WIN32_SHARE_PROCESS you must specify the LocalSystem account.

If the service type is SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER, the name is the driver object name that the system uses to load the device driver. Specify NULL if the driver is to use a default object name created by the I/O system.

lpPassword
Pointer to a null-terminated string that contains the password to the account name specified by the lpServiceStartName parameter. Specify NULL if you are not changing the password. Specify an empty string if the service has no password.

Passwords are ignored for driver services.

lpDisplayName
Pointer to a null-terminated string that is to be used by applications to identify the service for its users. 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.

Return Values

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.

Errors

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 control manager.

Value

Meaning

ERROR_ACCESS_DENIED

The specified handle was not opened with SERVICE_CHANGE_CONFIG access.

ERROR_CIRCULAR_DEPENDENCY

A circular service dependency was specified.

ERROR_DUP_NAME

The display name already exists in the service controller manager database, either as a service name or as another display name.

ERROR_INVALID_HANDLE

The specified handle is invalid.

ERROR_INVALID_PARAMETER

A parameter that was specified is invalid.

ERROR_INVALID_SERVICE_ACCOUNT

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.

ERROR_SERVICE_MARKED_FOR_DELETE

The service has been marked for deletion.

Remarks

The ChangeServiceConfig function changes the configuration information for the specified service in the service control manager database. You can obtain the current configuration information by using the QueryServiceConfig function.

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.

The startup program uses load ordering groups to load groups of services in a specified order with respect to the other groups in the list. The list of load ordering groups is contained in the ServiceGroupOrder value of the following registry key:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control 

See Also

CreateService, OpenService, QueryServiceConfig, StartService


file: /Techref/os/win/api/win32/func/src/f04_15.htm, 16KB, , updated: 2000/4/7 11:19, local time: 2024/12/3 05:11,
TOP NEW HELP FIND: 
3.129.195.254:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://ecomorder.com/Techref/os/win/api/win32/func/src/f04_15.htm"> ChangeServiceConfig</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .