<div class="content" name="NetrDfsEnum" uuid="f9dedb71-7575-4a50-9576-5f0f59891da4"><p>The NetrDfsEnum method enumerates the <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_639b7503-b879-4ef7-98a8-14adf85bc16d" data-linktype="relative-path">DFS root</a> hosted on a server
or the <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_0611e93d-f0e7-42ee-a591-d77ebcbb6619" data-linktype="relative-path">DFS links</a> of the
namespace hosted by a server. Depending on the information level, the targets
of the root and links are also displayed. </p><p>The NetrDfsEnum method uses the following <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_9c5903c1-1477-4181-b451-3ba1e34a0c0c" data-linktype="relative-path">MIDL</a> syntax.</p><dl>
<dd>
<div><pre> NET_API_STATUS NetrDfsEnum(
   [in] DWORD Level,
   [in] DWORD PrefMaxLen,
   [in, out, unique] DFS_INFO_ENUM_STRUCT* DfsEnum,
   [in, out, unique] DWORD* ResumeHandle
 );
</pre></div>
</dd></dl><p><b>Level: </b>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 <i>DfsEnum</i>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>Level_1 0x00000001</td>
  <td>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.</td>
 </tr><tr>
  <td>Level_2 0x00000002</td>
  <td>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.</td>
 </tr><tr>
  <td>Level_3 0x00000003</td>
  <td>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.</td>
 </tr><tr>
  <td>Level_4 0x00000004</td>
  <td>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.</td>
 </tr><tr>
  <td>Level_5 0x00000005</td>
  <td>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.</td>
 </tr><tr>
  <td>Level_6 0x00000006</td>
  <td>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.</td>
 </tr><tr>
  <td>Level_8 0x00000008</td>
  <td>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.</td>
 </tr><tr>
  <td>Level_9 0x00000009</td>
  <td>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.</td>
 </tr></tbody></table>
</dd>
<dd>
<p>The server MUST support <b>Level</b> 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 <b>Level</b>,
it MUST fail the call.<a id="Appendix_A_Target_62"></a><a aria-label="Product behavior note 62" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_62" data-linktype="relative-path">&lt;62&gt;</a> The
server SHOULD return error code ERROR_INVALID_PARAMETER for unsupported Level
values.<a id="Appendix_A_Target_63"></a><a aria-label="Product behavior note 63" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_63" data-linktype="relative-path">&lt;63&gt;</a></p>
</dd></dl><p><b>PrefMaxLen: </b>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.<a id="Appendix_A_Target_64"></a><a aria-label="Product behavior note 64" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_64" data-linktype="relative-path">&lt;64&gt;</a></p><p><b>DfsEnum: </b>A pointer to a DFS_INFO_ENUM_STRUCT
union to receive the returned information. The client SHOULD set the <b>Level</b>
member to the same value as the method&#39;s <i>Level</i> parameter, and MUST set
the <b>DfsInfoContainer</b> union member to a pointer to the corresponding
container structure as specified in section <a href="c61d8ced-e29e-4604-9a9b-9773f5d10403" data-linktype="relative-path">2.2.6</a>. The client MUST
initialize the container structure&#39;s <b>EntriesRead</b> member to zero and <b>Buffer</b>
member to a NULL pointer. The value of the <b>Level</b> member determines the
case of the union.</p><p><b>ResumeHandle: </b>This parameter is used to
continue an enumeration when more data is available than can be returned in a
single invocation of this method.</p><ul><li><p><span><span>  </span></span>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.</p>
</li><li><p><span><span>  </span></span>If
this parameter is a NULL pointer or points to a 0 value, it indicates that this
is an initial enumeration request.</p>
</li><li><p><span><span>  </span></span>If
this parameter is not a NULL pointer and points to a nonzero value returned in <i>ResumeHandle</i>
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 <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_6a3f0be9-b9b4-49df-9d1c-a3b89e4e9890" data-linktype="relative-path">DFS namespace</a>.<a id="Appendix_A_Target_65"></a><a aria-label="Product behavior note 65" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_65" data-linktype="relative-path">&lt;65&gt;</a></p>
</li></ul><p><b>Return Values: </b>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 <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>
section <a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a>.
The most common error codes are listed in the following table.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 ERROR_SUCCESS</td>
  <td>Successful completion.</td>
 </tr><tr>
  <td>0x00000057 ERROR_INVALID_PARAMETER</td>
  <td>An incorrect parameter was specified.</td>
 </tr><tr>
  <td>0x00000103 ERROR_NO_MORE_ITEMS</td>
  <td>There is no data to return.</td>
 </tr><tr>
  <td>0x00000490 ERROR_NOT_FOUND</td>
  <td>The specified DFS root namespace does not exist.</td>
 </tr><tr>
  <td>0x000010DF ERROR_DEVICE_NOT_AVAILABLE</td>
  <td>The server hosts more than one root.</td>
 </tr></tbody></table>
</dd></dl><p>A server MAY<a id="Appendix_A_Target_66"></a><a aria-label="Product behavior note 66" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_66" data-linktype="relative-path">&lt;66&gt;</a> implement
this method.</p><p>The server MUST verify that it hosts a DFS namespace. If
that check fails, the server MUST return ERROR_NOT_FOUND.</p><p>The server MUST return ERROR_NO_MORE_ITEMS (0x00000103) if
there is no data to return.</p><p>The server MUST return ERROR_DEVICE_NOT_AVAILABLE if the
server hosts more than one root.</p><p>Each member of the DFS_INFO_ENUM_STRUCT return buffer MUST
be constructed according to the rules of section <a href="b5dd4568-3ea4-4f27-ae03-3ebb19fa4b13" data-linktype="relative-path">3.1.4.1.6</a> (NetrDfsGetInfo)
for the specified value of the <i>Level</i> parameter.<a id="Appendix_A_Target_67"></a><a aria-label="Product behavior note 67" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_67" data-linktype="relative-path">&lt;67&gt;</a></p><p>If the requested <i>Level</i> is 1 through 9 and <i>ResumeHandle</i>
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.</p><p>If the requested <i>Level</i> is 1 through 9 and <i>ResumeHandle</i>
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.</p></div>