Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 1.55 KB

OpenSCManager.md

File metadata and controls

62 lines (41 loc) · 1.55 KB

Home

Function name : OpenSCManager

Group: Service - Library: advapi32


The OpenSCManager function establishes a connection to the service control manager on the specified computer and opens the specified service control manager database.


Code examples:

Encapsulating access to the Windows Services in a class
How to create a service object
How to delete a service object

Declaration:

SC_HANDLE OpenSCManager(
  LPCTSTR lpMachineName,
  LPCTSTR lpDatabaseName,
  DWORD dwDesiredAccess
);
  

FoxPro declaration:

DECLARE INTEGER OpenSCManager IN advapi32;
	STRING lpMachineName,;
	STRING lpDatabaseName,;
	LONG   dwDesiredAccess
  

Parameters:

lpMachineName [in] Pointer to a null-terminated string that specifies the name of the target computer.

lpDatabaseName [in] Pointer to a null-terminated string that specifies the name of the service control manager database to open.

dwDesiredAccess [in] Access to the service control manager.


Return value:

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


Comments:

The returned handle is only valid for the process that called the OpenSCManager function. It can be closed by calling the CloseServiceHandle function.