术语 | openservice |
释义 | OpenService 语法: C++ SC_HANDLE WINAPI OpenService( __in SC_HANDLE hSCManager, __in LPCTSTR lpServiceName, __in DWORD dwDesiredAccess ); OpenService函数 打开一个现有的服务。 参数 hSCManager [in] 一个句柄,服务控制管理数据库。该OpenSCManager函数返回此句柄。 lpServiceName [in] 这项服务的名称被打开。字符串的最大长度为256个字符。在服务控制管理数据库保存了字符的大小写,但服务名称比较总是不区分大小写。正斜杠(/)和反斜杠(\\)是无效的服务名称字符。 dwDesiredAccess [in] 对服务的访问。如需使用权名单见服务安全和访问权限。 在给予请求的访问,系统检查用户访问禁止自由访问调用进程令牌控制与服务对象相关的安全描述符列表。 返回值 如果函数成功,返回值是一个句柄服务。 如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。 下面的错误代码可以设置由服务控制管理器。其他可以设置的注册表由服务控制管理器调用的函数。 返回codeDescription ERROR_ACCESS_DENIEDThe处理无权访问该服务。 ERROR_INVALID_HANDLEThe指定的句柄无效。 ERROR_INVALID_NAMEThe指定的服务名称是无效的。 ERROR_SERVICE_DOES_NOT_EXISTThe指定的服务不存在。 备注 返回的句柄是唯一有效的过程称为OpenService。它可以关闭调用CloseServiceHandle功能。 实例 有关示例,请参阅启动一个服务。 要求: 最低支持:client-Windows 2000专业版 最低支持server-Windows 2000服务器 HeaderWinsvc.h(头文件:winuser.h) LibraryAdvapi32.lib DLLAdvapi32.dll Unicode和ANSI namesOpenServiceW(Unicode)和OpenServiceA(ANSI)的 参见 ChangeServiceConfig CloseServiceHandle ControlService CreateService DeleteService EnumDependentServices OpenSCManager QueryServiceConfig QueryServiceObjectSecurity QueryServiceStatusEx 供应链管理拉手 服务函数 SetServiceObjectSecurity StartService 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年8月27日 ==英文原文==OpenService Function Opens an existing service. Syntax C++ SC_HANDLE WINAPI OpenService( __in SC_HANDLE hSCManager, __in LPCTSTR lpServiceName, __in DWORD dwDesiredAccess ); Parameters hSCManager [in] A handle to the service control manager database. The OpenSCManager function returns this handle. lpServiceName [in] The name of the service to be opened. The maximum string length is 256 characters. The service control manager database preserves the case of the characters, but service name comparisons are always case insensitive. Forward-slash (/) and backslash (\\) are invalid service name characters. dwDesiredAccess [in] The access to the service. For a list of access rights, see Service Security and Access Rights . 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 object. Return Value If the function succeeds, the return value is a handle to the service. 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 service control manager. Others can be set by the registry functions that are called by the service control manager. Return codeDescription ERROR_ACCESS_DENIEDThe handle does not have access to the service. ERROR_INVALID_HANDLEThe specified handle is invalid. ERROR_INVALID_NAMEThe specified service name is invalid. ERROR_SERVICE_DOES_NOT_EXISTThe specified service does not exist. Remarks The returned handle is only valid for the process that called OpenService. It can be closed by calling the CloseServiceHandle function. Examples For an example, see Starting a Service . Requirements Minimum supported clientWindows 2000 Professional Minimum supported serverWindows 2000 Server HeaderWinsvc.h (include Windows.h) LibraryAdvapi32.lib DLLAdvapi32.dll Unicode and ANSI namesOpenServiceW (Unicode) and OpenServiceA (ANSI) See Also ChangeServiceConfig CloseServiceHandle ControlService CreateService DeleteService EnumDependentServices OpenSCManager QueryServiceConfig QueryServiceObjectSecurity QueryServiceStatusEx SCM Handles Service Functions SetServiceObjectSecurity StartService Send comments about this topic to Microsoft Build date: 8/27/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/ms684330(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。