3.1.4.1.7 NetrDfsEnum (Opnum 5)
The NetrDfsEnum method enumerates the DFS root hosted on a server or the DFS links of the namespace hosted by a server. Depending on the information level, the targets of the root and links are also displayed.
The NetrDfsEnum method uses the following MIDL syntax.
-
NET_API_STATUS NetrDfsEnum( [in] DWORD Level, [in] DWORD PrefMaxLen, [in, out, unique] DFS_INFO_ENUM_STRUCT* DfsEnum, [in, out, unique] DWORD* ResumeHandle );
Level: This parameter specifies the information level of the data and, in turn, determines the action that the method performs. On successful return, the server MUST return an array of the corresponding structures in the buffer pointed to by DfsEnum.
-
Value
Meaning
Level_1
0x00000001
Gets the name of the DFS root and all links beneath it. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_1 structures.
Level_2
0x00000002
Gets the name, comment, state, and number of targets for the DFS root and all links under the root. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_2 structures.
Level_3
0x00000003
Gets the name, comment, state, number of targets, and target information for the DFS root and all links under the root. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_3 structures.
Level_4
0x00000004
Gets the name, comment, state, time-out, GUID, number of targets, and target information for the DFS root and all links under the root. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_4 structures.
Level_5
0x00000005
Gets the name, comment, state, time-out, GUID, property flags, metadata size, and number of targets for a DFS root and all links under the root. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_5 structures.
Level_6
0x00000006
Gets the name, comment, state, time-out, GUID, property flags, metadata size, number of targets, and target information for a DFS root or DFS links. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_6 structures.
Level_8
0x00000008
Gets the name, comment, state, time-out, GUID, property flags, metadata size, and number of targets for a DFS root and all DFS links under the root. Also returns the security descriptor associated with each of the DFS links. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_8 structures.
Level_9
0x00000009
Gets the name, comment, state, time-out, GUID, property flags, metadata size, and number of targets, and target information for a DFS root and all DFS links under the root. Also returns the security descriptor associated with each of the DFS links. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_9 structures.
-
The server MUST support Level values 1, 2 and 3. The server SHOULD support Level values 5, 6, 8, 9, and 300. The server on a DC SHOULD support Level value 200. If the server does not support the provided Level, it MUST fail the call.<62> The server SHOULD return error code ERROR_INVALID_PARAMETER for unsupported Level values.<63>
PrefMaxLen: This parameter specifies restrictions on the number of elements returned. A value of 0xFFFFFFFF means there are no restrictions, in which case all entries MUST be returned.<64>
DfsEnum: A pointer to a DFS_INFO_ENUM_STRUCT union to receive the returned information. The client SHOULD set the Level member to the same value as the method's Level parameter, and MUST set the DfsInfoContainer union member to a pointer to the corresponding container structure as specified in section 2.2.6. The client MUST initialize the container structure's EntriesRead member to zero and Buffer member to a NULL pointer. The value of the Level member determines the case of the union.
ResumeHandle: This parameter is used to continue an enumeration when more data is available than can be returned in a single invocation of this method.
If this parameter is not a NULL pointer, and the method returns ERROR_SUCCESS, this parameter receives an implementation-specific nonzero value that can be passed in subsequent calls to this method to continue the enumeration.
If this parameter is a NULL pointer or points to a 0 value, it indicates that this is an initial enumeration request.
If this parameter is not a NULL pointer and points to a nonzero value returned in ResumeHandle by an earlier invocation of this method, the server will attempt to continue a previous enumeration, but MAY produce incomplete or inconsistent results due to the possibility of concurrent updates to the DFS namespace.<65>
Return Values: The method MUST return 0 on success and a nonzero error code on failure. The method can return any specific error code value, as specified in [MS-ERREF] section 2.2. The most common error codes are listed in the following table.
-
Return value/code
Description
0x00000000
ERROR_SUCCESS
Successful completion.
0x00000057
ERROR_INVALID_PARAMETER
An incorrect parameter was specified.
0x00000103
ERROR_NO_MORE_ITEMS
There is no data to return.
0x00000490
ERROR_NOT_FOUND
The specified DFS root namespace does not exist.
0x000010DF
ERROR_DEVICE_NOT_AVAILABLE
The server hosts more than one root.
A server MAY<66> implement this method.
The server MUST verify that it hosts a DFS namespace. If that check fails, the server MUST return ERROR_NOT_FOUND.
The server MUST return ERROR_NO_MORE_ITEMS (0x00000103) if there is no data to return.
The server MUST return ERROR_DEVICE_NOT_AVAILABLE if the server hosts more than one root.
Each member of the DFS_INFO_ENUM_STRUCT return buffer MUST be constructed according to the rules of section 3.1.4.1.6 (NetrDfsGetInfo) for the specified value of the Level parameter.<67>
If the requested Level is 1 through 9 and ResumeHandle indicates initial enumeration, the server MUST return the DFS root entry as the first member of the DFS_INFO_ENUM_STRUCT return buffer followed by DFS links in implementation-specific order.
If the requested Level is 1 through 9 and ResumeHandle does not indicate initial enumeration, the server MUST NOT return the DFS root entry and all the entries of the DFS_INFO_ENUM_STRUCT return buffer MUST be DFS links in implementation-specific order.