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。

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

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

  • ServerIsRemote 为 TRUE,并且客户端线程模拟其客户端而不是 SecurityDelegation 级别。

言论

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

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

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

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

要求

要求 价值
最低支持的客户端 Windows 2000
目标平台 普遍
标头 ntifs.h (include Ntifs.h)
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)