<div class="content" name="NetrDfsEnumEx" uuid="1e01d0ba-76f3-4346-9db3-c7cc61009054"><p>The NetrDfsEnumEx (Opnum 21) method enumerates the <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_639b7503-b879-4ef7-98a8-14adf85bc16d" data-linktype="relative-path">DFS roots</a> hosted on a
server, or <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_0611e93d-f0e7-42ee-a591-d77ebcbb6619" data-linktype="relative-path">DFS links</a> of
a namespace hosted by the server.<a id="Appendix_A_Target_92"></a><a aria-label="Product behavior note 92" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_92" data-linktype="relative-path">&lt;92&gt;</a><a id="Appendix_A_Target_93"></a><a aria-label="Product behavior note 93" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_93" data-linktype="relative-path">&lt;93&gt;</a> Depending on the information
level, the targets associated with the roots and links are also displayed. </p><p>The NetrDfsEnumEx 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 NetrDfsEnumEx(
   [in, string] WCHAR* DfsEntryPath,
   [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>DfsEntryPath: </b>The pointer to a <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_b0276eb2-4e65-4cf1-a718-e0920a614aca" data-linktype="relative-path">domain</a> name, a host name,
or a <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_151c87db-05a4-40c3-99bd-4b682530d210" data-linktype="relative-path">DFS path</a>, depending
on the <i>Level</i> parameter.</p><ul><li><p><span><span>  </span></span>A
domain name MUST be a null-terminated <a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_c305d0ab-8b94-461a-bd76-13b40cb8c4d8" data-linktype="relative-path">Unicode</a> string in the following
forms:</p>
<div><pre> &lt;DomainName&gt; or \&lt;DomainName&gt; or \\&lt;DomainName&gt;
  
</pre></div>
<p>where &lt;DomainName&gt; is
the domain name to use for the enumeration.</p>
</li><li><p><span><span>  </span></span>A
host name MUST be a null-terminated Unicode string in the following formats:</p>
<div><pre> &lt;ServerName&gt; or \&lt;ServerName&gt; or \\&lt;ServerName&gt;
  
</pre></div>
<p>where &lt;ServerName&gt; is a host name.</p>
</li><li><p><span><span>  </span></span>A
DFS root or a DFS link path.</p>
<p>When <i>DfsEntryPath</i>
points to a DFS link path, the remaining path after the DFS namespace name MUST
be ignored.</p>
</li></ul><p><b>Level: </b>This parameter specifies the
information level of the data and in turn determines the action the method
performs. On successful return, the server MUST return an array of the
corresponding structures in the buffer pointed to by <a href="562e366a-27db-49a9-8aae-b0e747245a69" data-linktype="relative-path">DfsEnum</a>.</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 information about each target 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 information about each target 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 root or link. 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 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 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><tr>
  <td>Level_200 0x000000C8</td>
  <td>Enumerates all of the domain-based DFS namespace in the specified domain. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_200 structures.</td>
 </tr><tr>
  <td>Level_300 0x0000012C</td>
  <td>Enumerates the stand-alone and domain-based DFS roots that the server hosts. In this case, on successful return DfsEnum MUST point to an array of DFS_INFO_300 structures.</td>
 </tr></tbody></table>
</dd>
<dd>
<p>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.<a id="Appendix_A_Target_94"></a><a aria-label="Product behavior note 94" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_94" data-linktype="relative-path">&lt;94&gt;</a> If the
server does not support the provided Level, it MUST fail the call. The server
SHOULD return error code ERROR_INVALID_PARAMETER for unsupported Level values.<a id="Appendix_A_Target_95"></a><a aria-label="Product behavior note 95" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_95" data-linktype="relative-path">&lt;95&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_96"></a><a aria-label="Product behavior note 96" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_96" data-linktype="relative-path">&lt;96&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 the <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 it points to a zero value, it indicates
that this is an initial enumeration.</p>
</li><li><p><span><span>  </span></span>If
this parameter is not a NULL pointer, and it 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.<a id="Appendix_A_Target_97"></a><a aria-label="Product behavior note 97" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_97" data-linktype="relative-path">&lt;97&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></tbody></table>
</dd></dl><p>The server MUST verify the existence of the DFS namespace
that the <i>DfsEntryPath</i> parameter specifies. If that existence 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>Unlike the <a href="f9dedb71-7575-4a50-9576-5f0f59891da4" data-linktype="relative-path">NetrDfsEnum</a> method, this
method can be used even when the server is hosting more than one DFS root.</p><p>If the server hosts exactly one DFS namespace, the requested
Level is 1 through 9, and the DfsEntryPath does not specify a DFS namespace
name, the server MAY enumerate the namespace it hosts.<a id="Appendix_A_Target_98"></a><a aria-label="Product behavior note 98" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_98" data-linktype="relative-path">&lt;98&gt;</a></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.</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>