SeCreateClientSecurityFromSubjectContext 函数 (ntifs.h)

SeCreateClientSecurityFromSubjectContext 例程检索安全主体上下文的访问令牌,并使用结果使用调用 SeImpersonateClientEx 所需的信息初始化安全客户端上下文。

语法

NTSTATUS SeCreateClientSecurityFromSubjectContext(
  [in]  PSECURITY_SUBJECT_CONTEXT    SubjectContext,
  [in]  PSECURITY_QUALITY_OF_SERVICE ClientSecurityQos,
  [in]  BOOLEAN                      ServerIsRemote,
  [out] PSECURITY_CLIENT_CONTEXT     ClientContext
);

参数

[in] SubjectContext

指向要模拟的客户端的安全主题上下文的指针。

[in] ClientSecurityQos

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

[in] ServerIsRemote

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

[out] ClientContext

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

返回值

SeCreateClientSecurityFromSubjectContext 在成功初始化安全客户端上下文时返回STATUS_SUCCESS。

当要模拟的客户端当前正在模拟自己的客户端,并且以下情况之一为 true 时,它将返回STATUS_BAD_IMPERSONATION_LEVEL:

  • 无法传递客户端的有效令牌供其他服务器使用,因为其模拟级别为 SecurityAnonymousSecurityIdentification

  • ServerIsRemote 为 TRUE,客户端线程在 SecurityDelegation 级别以外的其他级别模拟其客户端。

注解

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

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

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

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

要求

要求
最低受支持的客户端 Windows 2000
目标平台 通用
标头 ntifs.h (包括 Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL

另请参阅

[SECURITY_SUBJECT_CONTEXT/ (/windows-hardware/drivers/kernel/eprocess##security_subject_context)

[SeDeleteClientSecurity/ (nf-ntifs-sedeleteclientsecurity.md)

[SeImpersonateClientEx/ (nf-ntifs-seimpersonateclientex.md)