<div class="content"><p> </p><p>The NetrDfsEnumEx (Opnum 21) method enumerates the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_639b7503-b879-4ef7-98a8-14adf85bc16d" data-linktype="relative-path">DFS roots</a></span>
hosted on a server, or <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_0611e93d-f0e7-42ee-a591-d77ebcbb6619" data-linktype="relative-path">DFS links</a></span> 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 <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_9c5903c1-1477-4181-b451-3ba1e34a0c0c" data-linktype="relative-path">MIDL</a></span>
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 <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_b0276eb2-4e65-4cf1-a718-e0920a614aca" data-linktype="relative-path">domain</a></span>
name, a host name, or a <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_151c87db-05a4-40c3-99bd-4b682530d210" data-linktype="relative-path">DFS path</a></span>, depending
on the <i>Level</i> parameter.</p><ul><li><p><span><span>  </span></span>A
domain name MUST be a null-terminated <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_c305d0ab-8b94-461a-bd76-13b40cb8c4d8" data-linktype="relative-path">Unicode</a></span> 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 <span><a href="562e366a-27db-49a9-8aae-b0e747245a69" data-linktype="relative-path">DfsEnum</a></span>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>Level_1</p>
  <p>0x00000001</p>
  </td>
  <td>
  <p>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 <span><a href="c76762de-1249-485e-8a30-b1ff37179a3d" data-linktype="relative-path">DFS_INFO_1</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_2</p>
  <p>0x00000002</p>
  </td>
  <td>
  <p>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 <span><a href="a5dc283a-1fa7-4f09-a58a-0cfa3e5de625" data-linktype="relative-path">DFS_INFO_2</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_3</p>
  <p>0x00000003</p>
  </td>
  <td>
  <p>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 <span><a href="83704eb6-a3bc-4eac-8164-9625c2f2081e" data-linktype="relative-path">DFS_INFO_3</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_4</p>
  <p>0x00000004</p>
  </td>
  <td>
  <p>Gets the name, comment, state, time-out, <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_f49694cc-c350-462d-ab8e-816f0103c6c1" data-linktype="relative-path">GUID</a></span>,
  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 <span><a href="827866a0-973a-43a3-8df5-c5e1dd437320" data-linktype="relative-path">DFS_INFO_4</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_5</p>
  <p>0x00000005</p>
  </td>
  <td>
  <p>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 <span><a href="00691ea3-6542-44dc-8baf-200a7a747a1d" data-linktype="relative-path">DFS_INFO_5</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_6</p>
  <p>0x00000006</p>
  </td>
  <td>
  <p>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 <span><a href="30a81ad6-ace1-4312-8848-c8e03dca1a80" data-linktype="relative-path">DFS_INFO_6</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_8</p>
  <p>0x00000008</p>
  </td>
  <td>
  <p>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 <span><a href="907080e2-504f-4fba-a9a6-14113a734728" data-linktype="relative-path">DFS_INFO_8</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_9</p>
  <p>0x00000009</p>
  </td>
  <td>
  <p>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 <span><a href="60b51cc6-5c92-4446-92ee-a31252de1561" data-linktype="relative-path">DFS_INFO_9</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_200</p>
  <p>0x000000C8</p>
  </td>
  <td>
  <p>Enumerates all of the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_133ab305-ad75-4b38-8ec9-40bc0dc3b594" data-linktype="relative-path">domain-based DFS namespace</a></span>
  in the specified domain. In this case, on successful return DfsEnum MUST
  point to an array of <span><a href="5d6f6cd0-885f-47ed-b7a8-c5704cd7536f" data-linktype="relative-path">DFS_INFO_200</a></span>
  structures.</p>
  </td>
 </tr><tr>
  <td>
  <p>Level_300</p>
  <p>0x0000012C</p>
  </td>
  <td>
  <p>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 <span><a href="33e7c8c9-346e-4c0c-9dca-762291978711" data-linktype="relative-path">DFS_INFO_300</a></span>
  structures. </p>
  </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 <span><a href="c61d8ced-e29e-4604-9a9b-9773f5d10403" data-linktype="relative-path">2.2.6</a></span>. 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 <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>,
section <span><a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a></span>.
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>
  <p>0x00000000</p>
  <p>ERROR_SUCCESS</p>
  </td>
  <td>
  <p>Successful completion.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000057</p>
  <p>ERROR_INVALID_PARAMETER</p>
  </td>
  <td>
  <p>An incorrect parameter was specified.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000103</p>
  <p>ERROR_NO_MORE_ITEMS</p>
  </td>
  <td>
  <p>There is no data to return.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000490</p>
  <p>ERROR_NOT_FOUND</p>
  </td>
  <td>
  <p>The specified DFS root namespace does not exist.</p>
  </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 <span><a href="f9dedb71-7575-4a50-9576-5f0f59891da4" data-linktype="relative-path">NetrDfsEnum</a></span> 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 <span><a href="b5dd4568-3ea4-4f27-ae03-3ebb19fa4b13" data-linktype="relative-path">3.1.4.1.6</a></span>
(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>