To modify the configuration information for a service object, a configuration program uses the ChangeServiceConfig or ChangeServiceConfig2 function. For an example, see Changing a Service Configuration.
To retrieve the configuration information for a service object, the configuration program uses the QueryServiceConfig or QueryServiceConfig2 function. For an example, see Querying a Service's Configuration.
To modify the security descriptor for either an SCManager object or a service object, a configuration program uses the SetServiceObjectSecurity function. To retrieve a copy of the security descriptor, the configuration program uses the QueryServiceObjectSecurity function.
Before you reconfigure a service object, you should use the LockServiceDatabase function. This function tries to acquire a lock on the database and, if successful, prevents the SCM from starting a service while the database is being reconfigured. Failure to acquire a lock does not prevent a configuration program from successfully reconfiguring a service object. To release the lock on the database when the reconfiguration is complete, use the UnlockServiceDatabase function. To determine whether the database is locked, use the QueryServiceLockStatus function.