SeCreateClientSecurity 函数 (ntifs.h)

SeCreateClientSecurity 例程使用调用 SeImpersonateClientEx 所需的信息初始化安全客户端上下文结构。

语法

NTSTATUS SeCreateClientSecurity(
  [in]  PETHREAD                     ClientThread,
  [in]  PSECURITY_QUALITY_OF_SERVICE ClientSecurityQos,
        BOOLEAN                      RemoteSession,
  [out] PSECURITY_CLIENT_CONTEXT     ClientContext
);

参数

[in] ClientThread

指向要模拟的客户端线程的指针。

[in] ClientSecurityQos

指向调用方分配的SECURITY_QUALITY_OF_SERVICE结构的指针,该结构指示要执行哪种形式的模拟。

RemoteSession

如果客户端请求的服务器是远程服务器,则设置为 TRUE。

[out] ClientContext

指向要初始化的调用方分配SECURITY_CLIENT_CONTEXT结构的指针。

返回值

返回代码 说明
STATUS_SUCCESS 已成功初始化安全客户端上下文。
STATUS_BAD_IMPERSONATION_LEVEL 要模拟的客户端当前正在模拟自己的客户端,以下情况之一为 true: (1) 无法传递客户端的有效令牌供其他服务器使用,因为它的模拟级别为 SecurityAnonymousSecurityIdentification。 (2) ServerIsRemote 为 TRUE,并且客户端线程在 SecurityDelegation 级别以外的其他级别模拟其客户端。

注解

SeCreateClientSecurity 初始化客户端安全上下文块以表示客户端的安全上下文。

如果将 ClientSecurityQosContextTrackingMode 成员设置为 SECURITY_DYNAMIC_TRACKING 并且 ServerIsRemote 设置为 FALSE,则 SeCreateClientSecurity 将使用对客户端的有效令牌的引用。 否则, SeCreateClientSecurity 会创建客户端令牌的副本。

每次对 SeCreateClientSecurity 的调用都必须与对 SeDeleteClientSecurity 的后续调用匹配。

有关安全性和访问控制的详细信息,请参阅 面向驱动程序开发人员的 Windows 安全模型 和 Windows SDK 中有关这些主题的文档。

要求

要求
目标平台 通用
标头 ntifs.h (包括 Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL

另请参阅

SeDeleteClientSecurity

SeImpersonateClientEx