<div class="content" name="RpcEnumPorts" uuid="4f018733-e78e-4088-ac48-f6e19ee00863"><p>RpcEnumPorts enumerates the <span><a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_ac027425-6043-4ad3-be27-56a381b75d38" data-linktype="relative-path">ports</a></span> 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)] 
     BYTE* pPort,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded,
   [out] DWORD* pcReturned
 );
</pre></div>
</dd></dl><p><b>pName: </b>A parameter specified in <span><a href="acb355a4-913b-4abb-8cb5-415aea160015" data-linktype="relative-path">Print
Server Name Parameters</a></span>, 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>0x00000001</td>
  <td>Corresponds to _PORT_INFO_1 (section 2.2.2.8.1).</td>
 </tr><tr>
  <td>0x00000002</td>
  <td>Corresponds to _PORT_INFO_2 (section 2.2.2.8.2).</td>
 </tr></tbody></table>
</dd></dl><p><b>pPort: </b>A pointer to the BUFFER, as specified
in INFO Structures Query Parameters, section <span><a href="f29e9057-df29-40d4-9c51-c615c0da62a1" data-linktype="relative-path">3.1.4.1.9</a></span>.</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 <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>.</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 <span><a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_59fb3ddc-63cf-45df-8a90-46a6af9e00cb" data-linktype="relative-path">print server</a></span>.</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>