UnlockServiceDatabase function (winsvc.h)

[This function has no effect as of Windows Vista.]

Unlocks a service control manager database by releasing the specified lock.


BOOL UnlockServiceDatabase(
  [in] SC_LOCK ScLock


[in] ScLock

The lock, which is obtained from a previous call to the LockServiceDatabase function.

Return value

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 can be set by the service control manager. Other error codes can be set by the registry functions that are called by the service control manager.

Return code Description
The specified lock is invalid.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winsvc.h (include Windows.h)
Library Advapi32.lib
DLL Advapi32.dll

See also



Service Configuration

Service Functions