<div class="content"><p>RpcEnumPorts enumerates the <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_ac027425-6043-4ad3-be27-56a381b75d38" data-linktype="relative-path">ports</a> that are available
for printing on a specified server.</p><dl>
<dd>
<div><pre> DWORD RpcEnumPorts(
   [in, string, unique] STRING_HANDLE pName,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pPort,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded,
   [out] DWORD* pcReturned
 );
</pre></div>
</dd></dl><p><b>pName: </b>A parameter specified in <a href="acb355a4-913b-4abb-8cb5-415aea160015" data-linktype="relative-path">Print Server Name Parameters</a>,
section 3.1.4.1.4.</p><p><b>Level: </b>The port information level.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000001</p>
  </td>
  <td>
  <p>Corresponds to <a href="086847b9-a370-4149-9ced-a41ecb436d3b" data-linktype="relative-path">_PORT_INFO_1</a> (section
  2.2.2.8.1).</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000002</p>
  </td>
  <td>
  <p>Corresponds to <a href="d09458b8-4d2b-48f2-b750-0d07ea24f47a" data-linktype="relative-path">_PORT_INFO_2</a> (section
  2.2.2.8.2).</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>pPort: </b>A pointer to the BUFFER, as specified
in INFO Structures Query Parameters, section <a href="f29e9057-df29-40d4-9c51-c615c0da62a1" data-linktype="relative-path">3.1.4.1.9</a>.</p><p><b>BUFFER TYPE:</b> _PORT_INFO.</p><dl>
<dd>
<p>This parameter can be NULL if <i>cbBuf</i> equals
zero.</p>
</dd></dl><p><b>cbBuf: </b>A parameter specified in INFO
Structures Query Parameters.</p><p><b>pcbNeeded: </b>A parameter specified in INFO
Structures Query Parameters.</p><p><b>pcReturned: </b>A parameter specified in INFO
Structures Query Parameters.</p><p><b>Return Values: </b>This method MUST return zero
(ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error
code to indicate failure <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.</p><p>Upon receiving this message, the server MUST validate
parameters as follows:</p><ul><li><p><span><span> 
</span></span>Perform the validation steps specified in Print Server Name
Parameters, section 3.1.4.1.4.</p>
</li><li><p><span><span> 
</span></span>Perform the validation steps specified in INFO Structures Query
Parameters, section 3.1.4.1.9.</p>
</li><li><p><span><span> 
</span></span>Additional validation MAY<a id="Appendix_A_Target_356"></a><a aria-label="Product behavior note 356" href="e81cbc09-ab05-4a32-ae4a-8ec57b436c43#Appendix_A_356" data-linktype="relative-path">&lt;356&gt;</a> be
performed.</p>
</li></ul><p>If parameter validation fails, the server MUST fail the
operation immediately and return a nonzero error response to the client. Otherwise,
the server MUST process the message and compose a response to the client as
follows:</p><ul><li><p><span><span> 
</span></span>Enumerate all ports on the <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_59fb3ddc-63cf-45df-8a90-46a6af9e00cb" data-linktype="relative-path">print server</a>.</p>
</li><li><p><span><span> 
</span></span>Using the enumerated objects, perform the processing and response
steps specified in INFO Structures Query Parameters, section 3.1.4.1.9.</p>
</li><li><p><span><span> 
</span></span>Return the status of the operation.</p>
</li></ul></div>