共用方式為


RtlSetOwnerSecurityDescriptor 函式 (ntifs.h)

RtlSetOwnerSecurityDescriptor 例程會設定絕對格式安全性描述元的擁有者資訊。 它會取代安全性描述元中已存在的任何擁有者資訊。

語法

NTSYSAPI NTSTATUS RtlSetOwnerSecurityDescriptor(
  [in, out]      PSECURITY_DESCRIPTOR SecurityDescriptor,
  [in, optional] PSID                 Owner,
  [in, optional] BOOLEAN              OwnerDefaulted
);

參數

[in, out] SecurityDescriptor

要設定其擁有者之SECURITY_DESCRIPTOR結構的指標。 RtlSetOwnerSecurityDescriptor 會以新的擁有者取代任何現有的擁有者。

[in, optional] Owner

安全性描述項新主要擁有者的安全性標識碼 (SID) 結構的指標。 這個指標,而不是 SID 結構本身,會複製到安全性描述元中。 如果此參數 NULLRtlSetOwnerSecurityDescriptor 會清除安全性描述項的擁有者資訊。 這會將安全性描述元標示為沒有擁有者。

[in, optional] OwnerDefaulted

如果擁有者資訊衍生自默認機制,則設定為 TRUE。 如果此值 TRUE,則為預設資訊。 RtlSetOwnerSecurityDescriptor 在安全性描述元的 [SECURITY_DESCRIPTOR_CONTROL] 字段中設定SE_OWNER_DEFAULTED旗標。 如果此參數 FALSE,則會清除SE_OWNER_DEFAULTED旗標。

傳回值

RtlSetOwnerSecurityDescriptor 可以傳回下列其中一個狀態代碼:

傳回碼 描述
STATUS_SUCCESS
已成功設定或重設擁有者。
STATUS_UNKNOWN_REVISION
這個例程無法辨識指定的安全性描述元版本。
STATUS_INVALID_SECURITY_DESCR
指定的安全性描述元不是有效的絕對安全性描述元。

言論

如需安全性和訪問控制的詳細資訊,請參閱 適用於驅動程式開發人員的 Windows 安全性模型,以及 Windows SDK 中這些主題的檔。

要求

要求 價值
目標平臺 普遍
標頭 ntifs.h (include Ntifs.h)
連結庫 NtosKrnl.lib
DLL NtosKrnl.exe (核心模式):Ntdll.dll (使用者模式)
IRQL < DISPATCH_LEVEL

另請參閱

RtlCreateSecurityDescriptor

RtlCreateSecurityDescriptorRelative

RtlLengthSecurityDescriptor

RtlSetDaclSecurityDescriptor

RtlValidSecurityDescriptor

SECURITY_DESCRIPTOR

SECURITY_DESCRIPTOR_CONTROL

SID

SeAssignSecurity