3.1.4.8 Receiving NetrMessageNameEnum

On receipt of this message, the message server SHOULD check an internal access control list (ACL) to determine whether the message client is authorized to access the name list. If the ACL authorization check is performed, and the message client is not authorized to perform the operation, the message server MUST return ERROR_ACCESS_DENIED.<14>

Next, the message server MUST validate that the level passed in InfoStruct is either 0 or 1. If the level is any other value, the message server MUST return ERROR_INVALID_LEVEL.

If the message client specifies PrefMaxLen of 0xFFFFFFFF, the message server MUST attempt to return all names in a single buffer. Otherwise, if the message client specifies Level 0, and PrefMaxLen is larger than 11,776 bytes, the message server MUST return ERROR_INVALID_PARAMETER.<15>

The message server MUST iterate through its name table in order, starting with the name in ordinal position ResumeHandle. If ResumeHandle is larger than the number of names in the name table, the message server MUST return NERR_Success.

For each registered name, the message server MUST add a structure that contains the name to a return buffer. The type of structure used MUST be based on the value of Level, and MUST be as specified in section 2.2.2.5.

If the message server fills its buffer before it has iterated through all registered names, it MUST:

  • Return the buffer as InfoStruct.

  • Set ResumeHandle to the ordinal value of the last copied name plus 1.

  • Set TotalEntries to the number of names in the buffer.

  • Return NERR_BufTooSmall.

If the last registered name is copied into the buffer, the message server MUST:

  • Copy the buffer to InfoStruct.

  • Set TotalEntries to the number of names in the buffer.

  • Return NERR_Success.