please dont rip this site Prev Next

OpenSCManager info  Overview  Group

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

SC_HANDLE OpenSCManager(

    LPCTSTR lpMachineName,

// pointer to machine name string

    LPCTSTR lpDatabaseName,

// pointer to database name string

    DWORD dwDesiredAccess 

// type of access

   );

Parameters

lpMachineName
Points to a null-terminated string that names the target computer. If the pointer is NULL or points to an empty string, the function connects to the service control manager on the local computer.
lpDatabaseName
Points to a null-terminated string that names the service control manager database to open. This parameter should be set to SERVICES_ACTIVE_DATABASE. If it is NULL, the SERVICES_ACTIVE_DATABASE database is opened by default.
dwDesiredAccess
Specifies the access to the service control manager. Before granting the requested access, the system checks the access token of the calling process against the discretionary access-control list of the security descriptor associated with the service control manager. The SC_MANAGER_CONNECT access type is implicitly specified by calling this function. In addition, any or all of the following service control manager object access types can be specified:

Type

Description

SC_MANAGER_ALL_ACCESS

Includes STANDARD_RIGHTS_REQUIRED, in addition to all of the access types listed in this table.

SC_MANAGER_CONNECT

Enables connecting to the service control manager.

SC_MANAGER_CREATE_SERVICE

Enables calling of the CreateService function to create a service object and add it to the database.

SC_MANAGER_ENUMERATE_SERVICE

Enables calling of the EnumServicesStatus function to list the services that are in the database.

SC_MANAGER_LOCK

Enables calling of the LockServiceDatabase function to acquire a lock on the database.

SC_MANAGER_QUERY_LOCK_STATUS

Enables calling of the QueryServiceLockStatus function to retrieve the lock status information for the database.

The dwDesiredAccess parameter can specify any or all of the following generic access types:

Generic access

Service manager access

GENERIC_READ

Combines the following access types: STANDARD_RIGHTS_READ, SC_MANAGER_ENUMERATE_SERVICE, and SC_MANAGER_QUERY_LOCK_STATUS.

GENERIC_WRITE

Combines the following access types: STANDARD_RIGHTS_WRITE and SC_MANAGER_CREATE_SERVICE.

GENERIC_EXECUTE

Combines the following access types: STANDARD_RIGHTS_EXECUTE, SC_MANAGER_CONNECT, and SC_MANAGER_LOCK.

Return Values

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

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Errors

The following error codes can be set by the SCM. Other error codes can be set by the registry functions that are called by the SCM.

Error code

Meaning

ERROR_ACCESS_DENIED

The requested access was denied.

ERROR_DATABASE_DOES_NOT_EXIST

The specified database does not exist.

ERROR_INVALID_PARAMETER

A specified parameter is invalid.

Remarks

When a process uses the OpenSCManager function to open a handle to a service control manager database, the system performs a security check before granting the requested access. All processes are permitted SC_MANAGER_CONNECT, SC_MANAGER_ENUMERATE_SERVICE, and SC_MANAGER_QUERY_LOCK_STATUS access to all service control manager databases. This enables any process to open a service control manager database handle that it can use in the OpenService, EnumServicesStatus, and QueryServiceLockStatus functions. Only processes with Administrator privileges are able to open a database handle used by the CreateService and LockServiceDatabase functions.

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

See Also

CloseServiceHandle, CreateService, EnumServicesStatus, LockServiceDatabase, OpenService, QueryServiceLockStatus

See also:


file: /Techref/os/win/api/win32/func/src/f66_8.htm, 8KB, , updated: 2000/4/7 12:19, local time: 2022/5/23 15:48,
TOP NEW HELP FIND: 
3.238.72.122:LOG IN

 ©2022 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://www.piclist.com/techref/os/win/api/win32/func/src/f66_8.htm"> OpenSCManager</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?

  PICList 2022 contributors:
o List host: MIT, Site host massmind.org, Top posters @20220523
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .