网站首页  词典首页

请输入您要查询的函数:

 

术语 openscmanager
释义 OpenSCManager
语法:
C++
SC_HANDLE WINAPI OpenSCManager(
__in_opt LPCTSTR lpMachineName,
__in_opt LPCTSTR lpDatabaseName,
__in DWORD dwDesiredAccess
);
OpenSCManager函数
建立一个连接到指定的计算机上的服务控制管理器并打开指定的服务控制管理数据库。
参数
lpMachineName [中,可选]
在目标计算机的名称。如果指针为NULL或为空字符串点,函数连接到本地计算机上的服务控制管理器。
lpDatabaseName [中,可选]
在服务控制管理数据库的名称。此参数应设置为SERVICES_ACTIVE_DATABASE。如果是NULL,则SERVICES_ACTIVE_DATABASE打开数据库默认情况下。
dwDesiredAccess [in]
到服务控制管理器访问。如需使用权名单见服务安全和访问权限。
前给予所要求的访问权限,系统检查用户访问禁止自由访问调用进程令牌控制与服务控制管理器相关的安全描述符列表。
在SC_MANAGER_CONNECT探视权,指定隐含调用这个函数。
返回值
如果函数成功,返回值是一个句柄到指定的服务控制管理数据库。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
下面的错误代码可以设置的供应链管理。其他的错误代码可以设置的注册表由单片机调用的函数。
返回codeDescription
ERROR_ACCESS_DENIEDThe请求的访问被拒绝。
ERROR_DATABASE_DOES_NOT_EXISTThe指定的数据库不存在。
ERROR_INVALID_PARAMETERA指定的参数无效。
备注
当一个进程使用OpenSCManager函数打开的句柄服务控制管理数据库,系统执行一个请求之前,授予访问安全检查。有关更多信息,请参阅服务安全和访问权限。
只有具有管理员权限的进程能够打开一个数据库句柄可以通过CreateService函数使用。
返回的句柄的进程只调用该OpenSCManager函数有效。它可以关闭调用CloseServiceHandle功能。
实例
有关示例,请参阅更改一个服务的配置。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinsvc.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesOpenSCManagerW(Unicode)和OpenSCManagerA(ANSI)的
参见
CloseServiceHandle
CreateService
EnumServicesStatusEx
OpenService
供应链管理拉手
服务函数
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==OpenSCManager Function
Establishes a connection to the service control manager on the specified computer and opens the specified service control manager database.
Syntax
C++
SC_HANDLE WINAPI OpenSCManager(
__in_opt LPCTSTR lpMachineName,
__in_opt LPCTSTR lpDatabaseName,
__in DWORD dwDesiredAccess
);
Parameters
lpMachineName [in, optional]
The name of 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 [in, optional]
The name of the service control manager database. This parameter should be set to SERVICES_ACTIVE_DATABASE. If it is NULL, the SERVICES_ACTIVE_DATABASE database is opened by default.
dwDesiredAccess [in]
The access to the service control manager. For a list of access rights, see Service Security and Access Rights .
Before granting the requested access rights, 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 right is implicitly specified by calling this function.
Return Value
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 .
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.
Return codeDescription
ERROR_ACCESS_DENIEDThe requested access was denied.
ERROR_DATABASE_DOES_NOT_EXISTThe specified database does not exist.
ERROR_INVALID_PARAMETERA 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. For more information, see Service Security and Access Rights .
Only processes with Administrator privileges are able to open a database handle that can be used by the CreateService function.
The returned handle is only valid for the process that called the OpenSCManager function. It can be closed by calling the CloseServiceHandle function.
Examples
For an example, see Changing a Service's Configuration .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinsvc.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesOpenSCManagerW (Unicode) and OpenSCManagerA (ANSI)
See Also
CloseServiceHandle
CreateService
EnumServicesStatusEx
OpenService
SCM Handles
Service Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms684323(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:24:55