NTSTATUS
SeAssignSecurity(
IN PSECURITY_DESCRIPTOR ParentDescriptor, /* optional*/
IN PSECURITY_DESCRIPTOR ExplicitDescriptor,
OUT PSECURITY_DESCRIPTOR *NewDescriptor,
IN BOOLEAN IsDirectoryObject,
IN PSECURITY_SUBJECT_CONTEXT SubjectContext,
IN PGENERIC_MAPPING GenericMapping,
IN POOL_TYPE PoolType
);
SeAssignSecurity builds a self-relative security descriptor for a new object, given the security descriptor of its parent directory and any originally requested security for the object.
NonPagedPool
PagedPool
NonPagedPoolMustSucceed
NonPagedPoolCacheAligned
NonPagedPoolCacheAlignedMustS
PagedPoolCacheAligned
Usually, a caller specifies PagedPool, or else NonPagedPool if the buffer will be accessed at raised IRQL in an arbitrary thread context.
SeAssignSecurity can return one of the following:
Status |
Meaning |
STATUS_SUCCESS |
Indicates the operation was successful. |
STATUS_INVALID_OWNER |
The owner SID that was provided as the owner of the target security descriptor is not one the caller is authorized to assign as the owner of an object. |
STATUS_PRIVILEGE_NOT_HELD |
The caller does not have the privilege (SeSecurityPrivilege) necessary to explicitly assign the specified system ACL. |
Network transport drivers call this routine.
The final security descriptor returned to the caller may contain a mix of information, some explicitly provided from the new object’s parent.
SeAssignSecurity assumes privilege checking has not been performed. This routine performs privilege checking.
The assignment of system and discretionary ACLs is governed by the logic illustrated in the following table:
Explicit (nondefault) ACL specified |
Explicit default ACL specified |
No ACL specified | |
Inheritable ACL from parent |
Assign specified ACL |
Assign inherited ACL |
Assign inherited ACL |
No inheritable ACL from parent |
Assign specified ACL |
Assign default ACL |
Assign no ACL |
An explicitly specified ACL, whether a default ACL or not, can be empty or null. The caller must be a kernel-mode client or be appropriately privileged to explicitly assign a default or nondefault system ACL.
The assignment of the new object’s owner and group is governed by the following logic:
Callers of SeAssignSecurity must be running at IRQL PASSIVE_LEVEL.