NTSTATUS
RtlpGenerateInheritedAce(
  IN  PACE_HEADER OldAce,
  IN  BOOLEAN IsDirectoryObject,
  IN  PSID ClientOwnerSid,
  IN  PSID ClientGroupSid,
  IN  PSID ServerOwnerSid OPTIONAL,
  IN  PSID ServerGroupSid OPTIONAL,
  IN  PGENERIC_MAPPING GenericMapping,
  OUT PACL NewAcl
  );

Routine Description:

    This is a private routine that checks if the input ace is inheritable
    and produces 0, 1, or 2 inherited aces in the given buffer.

    See RtlpLengthInheritedAce() for detailed information on ACE inheritance.

    THE CODE IN THIS ROUTINE MUST MATCH THE CODE IN RtlpLengthInheritanceAce()!!!

Arguments:

    OldAce - Supplies the ace being inherited

    IsDirectoryObject - Specifies if the new ACE is for a directory

    ClientOwnerSid - Specifies the owner Sid to use

    ClientGroupSid - Specifies the new Group Sid to use

    ServerSid - Optionally specifies the Server Sid to use in compound ACEs.

    ClientSid - Optionally specifies the Client Sid to use in compound ACEs.

    GenericMapping - Specifies the generic mapping to use

    NewAcl - Provides a pointer to the ACL into which the ACE is to be
        inherited.

Return Value:

    STATUS_SUCCESS - The ACE was inherited successfully.

    STATUS_BAD_INHERITANCE_ACL - Indicates something went wrong preventing
        the ACE from being inherited.  This generally represents a bugcheck
        situation when returned from this call.