<div class="content"><p> </p><p>The <b>NetrEnumerateComputerNames</b> method returns a list
of <span><a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_9a7bc8b3-3374-4608-8f73-be20a90b898b" data-linktype="relative-path">computer
names</a></span> for a specified <span><a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server (2)</a></span>. The
results of the query are determined by the type of the name. <a id="Appendix_A_Target_120"></a><a aria-label="Product behavior note 120" href="def80006-2495-4571-8a93-1668e0f8af31#Appendix_A_120" data-linktype="relative-path">&lt;120&gt;</a></p><dl>
<dd>
<div><pre> unsigned long NetrEnumerateComputerNames(
   [in, string, unique] WKSSVC_IMPERSONATE_HANDLE ServerName,
   [in] NET_COMPUTER_NAME_TYPE NameType,
   [in] unsigned long Reserved,
   [out] PNET_COMPUTER_NAME_ARRAY* ComputerNames
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>A <b>WKSSVC_IMPERSONATE_HANDLE</b>
structure (section <span><a href="2427e140-22b3-45f8-9e12-1b3593308e46" data-linktype="relative-path">2.2.2.2</a></span>) that
specifies the server. The <span><a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_60e0e1fa-66fe-41e1-b5e3-ceab97e53506" data-linktype="relative-path">client</a></span> MUST map this
structure to an <span><a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> binding <span><a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_5044babb-08e3-4bb9-bc12-fe8f542b05ee" data-linktype="relative-path">handle</a></span>
(<span><a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a></span> sections
4.3.5 and 5.1.5.2). The server MUST ignore this parameter.</p><p><b>NameType: </b>The type of query issued. See <b>NET_COMPUTER_NAME_TYPE
</b>(section <span><a href="10d46710-ae87-468a-a34e-52bef0170307" data-linktype="relative-path">2.2.3.3</a></span>).</p><p><b>Reserved: </b>A 32-bit bitfield that SHOULD be set
to zero.</p><dl>
<dd>
<table>
 <tbody><tr>
  <th><p><br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>1<br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>2<br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>3<br/>0</p></th>
  <th><p><br/>1</p></th>
 </tr>
 <tr>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>IU</p>
  </td>
 </tr>
</tbody></table>
</dd>
<dd>
<p>Where the bits are defined as:</p>
</dd>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>IU</p>
  <p>NET_IGNORE_UNSUPPORTED_FLAGS</p>
  </td>
  <td>
  <p>If 1, the server MUST ignore the values of the other
  bits in this field.</p>
  <p>If 0, the values of the other bits in this field MUST
  be 0; otherwise, the server MUST return ERROR_INVALID_FLAGS. <a id="Appendix_A_Target_121"></a><a aria-label="Product behavior note 121" href="def80006-2495-4571-8a93-1668e0f8af31#Appendix_A_121" data-linktype="relative-path">&lt;121&gt;</a></p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>ComputerNames: </b>A pointer to structure
containing a list of computer name strings. See <b>NET_COMPUTER_NAME_ARRAY</b>
(section <span><a href="2dc431fb-01c9-4cc9-bfc8-65cce9c6e649" data-linktype="relative-path">2.2.5.21</a></span>).</p><p><b>Return Values: </b>When the message processing
result meets the description in column two of the following table, this method
MUST return one of the following values (<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>).</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value/code</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>NERR_Success</p>
  <p>0x00000000</p>
  </td>
  <td>
  <p>The operation completed successfully.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_ACCESS_DENIED</p>
  <p>0x00000005</p>
  </td>
  <td>
  <p>Access is denied.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_NOT_ENOUGH_MEMORY</p>
  <p>0x00000008</p>
  </td>
  <td>
  <p>Not enough storage is available to process this
  command.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_INVALID_PARAMETER</p>
  <p>0x00000057</p>
  </td>
  <td>
  <p>The parameter is incorrect.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_NOT_SUPPORTED</p>
  <p>0x00000032</p>
  </td>
  <td>
  <p>This method is not supported by this server.</p>
  </td>
 </tr><tr>
  <td>
  <p>ERROR_INVALID_FLAGS</p>
  <p>0x000003EC</p>
  </td>
  <td>
  <p>Reserved contains an invalid value.</p>
  </td>
 </tr><tr>
  <td>
  <p>RPC_S_PROTSEQ_NOT_SUPPORTED</p>
  <p>0x000006A7</p>
  </td>
  <td>
  <p>The <span><a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_0c171cc7-e9c4-41b6-95a9-536db0042c7a" data-linktype="relative-path">RPC protocol sequence</a></span>
  is not supported.</p>
  </td>
 </tr><tr>
  <td>
  <p>RPC_S_CALL_IN_PROGRESS</p>
  <p>0x000006FF</p>
  </td>
  <td>
  <p>A remote procedure call is already in progress.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>Any other return value MUST conform to the error code
requirements in <b>Protocol Details</b> (section <span><a href="aeea622a-ea3e-40cc-a9b1-b4a2a3b2bf6b" data-linktype="relative-path">3</a></span>).</p><p>The following statements define the sequence of message
processing operations.</p><ol><li><p><span>    </span>The server MUST
retrieve the RPC protocol sequence used for the current call (<span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>
section <span><a href="../ms-rpce/0ceefe4c-0d7a-423f-bcd0-54e821767f89" data-linktype="relative-path">3.1.3.4.1</a></span>),
specifying the server binding handle maintained by the RPC runtime ([C706]
section 6.2.1). If that RPC protocol sequence is not <b>NCACN_NP</b>, the
server SHOULD return <b>RPC_S_PROTSEQ_NOT_SUPPORTED</b>.<a id="Appendix_A_Target_122"></a><a aria-label="Product behavior note 122" href="def80006-2495-4571-8a93-1668e0f8af31#Appendix_A_122" data-linktype="relative-path">&lt;122&gt;</a></p>
</li><li><p><span>    </span>The server MUST
check that the caller has been granted access rights using the algorithm in the
<b>Access Control Abstract Data Model</b> (section <span><a href="c5b75090-3de2-404f-8de1-d5ca3fc38a70" data-linktype="relative-path">3.2.1.1</a></span>), with <i>Access
Request mask</i> initialized to <b>WKSTA_NETAPI_CHANGE_CONFIG</b>; if not, the
server MUST return ERROR_ACCESS_DENIED.</p>
</li><li><p><span>    </span>The server
SHOULD<a id="Appendix_A_Target_123"></a><a aria-label="Product behavior note 123" href="def80006-2495-4571-8a93-1668e0f8af31#Appendix_A_123" data-linktype="relative-path">&lt;123&gt;</a> return ERROR_NOT_SUPPORTED if
the server is a client <span><a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_dcea8721-5213-4954-bc73-d75ad6cb5591" data-linktype="relative-path">SKU</a></span> configuration.</p>
</li><li><p><span>    </span>The server MUST
return ERROR_INVALID_PARAMETER if <i>NameType</i> is greater than or equal to <b>NetComputerNameTypeMax</b>.</p>
</li><li><p><span>    </span>The server MUST
impersonate the client by invoking the <b>StartImpersonatingClient</b> task
(section <span><a href="719ae534-d5d7-4c42-9989-d63e0676fad1" data-linktype="relative-path">3.2.4.29.6</a></span>). If
this operation fails, the server MUST return an error.</p>
</li><li><p><span>    </span>The server MUST
initialize the output parameter <i>ComputerNames</i> as follows depending on
the input query type in <i>NameType</i>.</p>
<ul><li><p><span><span>  </span></span><b>NetPrimaryComputerName:</b></p>
<p>The server MUST set <i>ComputerNames.EntryCount</i>
to 1 and initialize the UNICODE_STRING values in <i>ComputerNames</i> to <b>ComputerNameFQDN</b>
(section <span><a href="e0b508bc-764d-48b7-b44b-4f93c3d5cf8c" data-linktype="relative-path">3.2.1.5</a></span>).</p>
</li><li><p><span><span>  </span></span><b>NetAlternateComputerNames:</b></p>
<p>The server MUST set <i>ComputerNames.EntryCount</i>
to the number of tuples contained in <b>alternate-computer-names</b> (section <span><a href="b1cb0684-fdeb-4fa2-8e12-c124ef64025f" data-linktype="relative-path">3.2.1.2</a></span>).
For each tuple, I, the server MUST initialize the next available UNICODE_STRING
elements in the <i>ComputerNames</i> array to equal the values stored in <i>alternate-computer-names[I]</i>.FQDN.</p>
</li><li><p><span><span>  </span></span><b>NetAllComputerNames:</b></p>
<p>The server MUST set <i>ComputerNames.EntryCount</i>
to the number of tuples contained in <b>alternate-computer-names</b> + 1. The <i>ComputerNames</i>
array MUST be initialized to return all the names specified for the <b>NetPrimaryComputerName</b>
and <b>NetAlternateComputerNames</b> input query types.</p>
</li></ul></li><li><p><span>    </span>The server MUST
stop impersonating the client by invoking the <b>StopImpersonatingClient</b>
task (section <span><a href="cf258b4a-d66b-4407-85f7-aac7823ec0aa" data-linktype="relative-path">3.2.4.29.7</a></span>).</p>
</li></ol><p>If no errors occur, the server MUST return NERR_Success.</p></div>