Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 1.2 KB

LockServiceDatabase.md

File metadata and controls

52 lines (33 loc) · 1.2 KB

Home

Function name : LockServiceDatabase

Group: Service - Library: advapi32


The LockServiceDatabase function requests ownership of the service control manager database lock. Only one process can own the lock at any given time.


Code examples:

Encapsulating access to the Windows Services in a class

Declaration:

SC_LOCK LockServiceDatabase(
  SC_HANDLE hSCManager
);  

FoxPro declaration:

DECLARE INTEGER LockServiceDatabase IN advapi32;
	INTEGER hSCManager  

Parameters:

hSCManager [in] Handle to the service control manager database.


Return value:

If the function succeeds, the return value is a lock to the specified service control manager database.


Comments:

The hSCManager handle is returned by the OpenSCManager function, and must have the SC_MANAGER_LOCK access right.

A call to the StartService function to start a service in a locked database fails. No other service control manager functions are affected by a lock.

See also: UnlockServiceDatabase, OpenSCManager.