网站首页  词典首页

请输入您要查询的函数:

 

术语 lockservicedatabase
释义 LockServiceDatabase
语法:
C++
SC_LOCK WINAPI LockServiceDatabase(
__in SC_HANDLE hSCManager
);
LockServiceDatabase功能
[As of Windows Vista, this function is provided for application compatibility and has no effect on the database.]
请所有权服务控制管理器(SCM)的数据库锁。只有一个进程可以拥有在任何指定时间锁定。
参数
hSCManager [in]
一个句柄,供应链管理数据库。这种处理是由OpenSCManager函数返回,并必须有SC_MANAGER_LOCK访问权限。有关更多信息,请参阅服务安全和访问权限。
返回值
如果函数成功,返回值是一个指定的供应链管理数据库锁。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
下面的错误代码可以设置的供应链管理。其它错误代码,可以设置注册表的供应链管理调用的函数。
返回codeDescription
ERROR_ACCESS_DENIEDThe处理不具备SC_MANAGER_LOCK访问权限。
ERROR_INVALID_HANDLEThe指定的句柄无效。
ERROR_SERVICE_DATABASE_LOCKEDThe数据库已锁定。
备注
锁是由安装和配置程序和单片机用于连续访问注册表中的服务,树的协议。唯一的一次供应链管理的要求锁的所有权时,启动服务。
一种程序,获得了供应链管理数据库锁定,不能将它释放无法启动其他服务的供应链管理。由于这个问题的严重性,过程不再允许锁定数据库。为了与旧应用程序的兼容性,在LockServiceDatabase函数返回一个锁,但没有其他作用。
Windows Server 2003和Windows XP/2000操作系统:
收购供应链管理数据库锁定无法启动,直到该锁被释放的供应链管理服务。例如,一个程序,必须配置几个相关的服务,其中前开始,可调用任何配置之前,第一个服务LockServiceDatabase。另外,它可以确保服务都不是开始,直至配置已经完成。
向StartService函数调用开始锁定数据库服务失败。没有其他的SCM功能都受到锁。
该锁一直保持到SC_LOCK句柄在随后的调用中指定的UnlockServiceDatabase功能。如果一个进程拥有锁终止时,单片机自动清除和释放锁的所有权。
不释放锁可能会导致系统出现问题。阿进程获得锁应该释放它尽快。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinsvc.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
参见
ChangeServiceConfig
OpenSCManager
QueryServiceLockStatus
服务配置
服务函数
SetServiceObjectSecurity
StartService
UnlockServiceDatabase
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==LockServiceDatabase Function
[As of Windows Vista, this function is provided for application compatibility and has no effect on the database.]
Requests ownership of the service control manager (SCM) database lock. Only one process can own the lock at any specified time.
Syntax
C++
SC_LOCK WINAPI LockServiceDatabase(
__in SC_HANDLE hSCManager
);
Parameters
hSCManager [in]
A handle to the SCM database. This handle is returned by the OpenSCManager function, and must have the SC_MANAGER_LOCK access right. For more information, see Service Security and Access Rights .
Return Value
If the function succeeds, the return value is a lock to the specified SCM 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 registry functions that are called by the SCM.
Return codeDescription
ERROR_ACCESS_DENIEDThe handle does not have the SC_MANAGER_LOCK access right.
ERROR_INVALID_HANDLEThe specified handle is not valid.
ERROR_SERVICE_DATABASE_LOCKEDThe database is locked.

Remarks
A lock is a protocol used by setup and configuration programs and the SCM to serialize access to the service tree in the registry. The only time the SCM requests ownership of the lock is when it is starting a service.
A program that acquires the SCM database lock and fails to release it prevents the SCM from starting other services. Because of the severity of this issue, processes are no longer allowed to lock the database. For compatibility with older applications, the LockServiceDatabase function returns a lock but has no other effect.
Windows Server 2003 and Windows XP/2000:
Acquiring the SCM database lock prevents the SCM from starting a service until the lock is released. For example, a program that must configure several related services before any of them starts could call LockServiceDatabase before configuring the first service. Alternatively, it could ensure that none of the services are started until the configuration has been completed.
A call to the StartService function to start a service in a locked database fails. No other SCM functions are affected by a lock.
The lock is held until the SC_LOCK handle is specified in a subsequent call to the UnlockServiceDatabase function. If a process that owns a lock terminates, the SCM automatically cleans up and releases ownership of the lock.
Failing to release the lock can cause system problems. A process that acquires the lock should release it as soon as possible.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinsvc.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
See Also
ChangeServiceConfig
OpenSCManager
QueryServiceLockStatus
Service Configuration
Service Functions
SetServiceObjectSecurity
StartService
UnlockServiceDatabase
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms684194(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:21:05