<div class="content"><p>Removes a <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_ac027425-6043-4ad3-be27-56a381b75d38" data-linktype="relative-path">port</a>.<a id="Appendix_A_Target_357"></a><a aria-label="Product behavior note 357" href="e81cbc09-ab05-4a32-ae4a-8ec57b436c43#Appendix_A_357" data-linktype="relative-path">&lt;357&gt;</a></p><dl>
<dd>
<div><pre> DWORD RpcDeletePort(
   [in, string, unique] STRING_HANDLE pName,
   [in] ULONG_PTR hWnd,
   [in, string] wchar_t* pPortName
 );
</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 (section 3.1.4.1.4)</a>.</p><p><b>hWnd: </b>The value of this parameter SHOULD be
set to zero when sent and MUST be ignored on receipt.</p><p><b>pPortName: </b>A pointer to a string that
specifies the name of the port that is deleted. For rules governing port names,
see section <a href="03c5feb7-4fbb-4569-b064-9eb6ad833f50" data-linktype="relative-path">2.2.4.10</a>.</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 the
following:</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>Verify that the string that is referenced by <i>pPortName</i>
represents a port installed on the server, and if that validation fails, return
ERROR_UNKNOWN_PORT.</p>
</li><li><p><span><span> 
</span></span>Verify that the <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_1b5f368b-942b-40dd-84ea-fa9082916216" data-linktype="relative-path">port
monitor</a> for the port supports the <b>DeletePort</b> <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_971b7035-4384-4e85-9878-b88c49aef05e" data-linktype="relative-path">monitor module</a> method, and
if that validation fails, return ERROR_NOT_SUPPORTED.</p>
</li><li><p><span><span> 
</span></span>Verify that the port is not being used by any printer or print
job in the system, and if that validation fails, return ERROR_BUSY.</p>
</li><li><p><span><span> 
</span></span>Additional validation MAY<a id="Appendix_A_Target_358"></a><a aria-label="Product behavior note 358" href="e81cbc09-ab05-4a32-ae4a-8ec57b436c43#Appendix_A_358" data-linktype="relative-path">&lt;358&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>Clear the references to this port from any other data structures.</p>
</li><li><p><span><span> 
</span></span>Delete the port object.</p>
</li><li><p><span><span> 
</span></span>Modify the list of ports in the system to exclude the deleted
port.</p>
</li><li><p><span><span> 
</span></span>If any clients have registered for notification of server object
changes, a notification MUST be broadcast to them.</p>
</li><li><p><span><span> 
</span></span>Return the status of the operation.</p>
</li></ul></div>