<div class="content"><p> </p><p>The RemoteQMCloseQueue method closes a <span><a href="f1ee7337-3674-4055-9475-1b5f5f1aa9b9" data-linktype="relative-path">PCTX_RRSESSION_HANDLE_TYPE</a></span>
that was previously opened by using a call to the <span><a href="0dbcb6fd-ed56-44c3-9c02-e9fa2d7798b3" data-linktype="relative-path">RemoteQMOpenQueue</a></span>
method. The client MUST call this method to reclaim resources on the server
allocated by the RemoteQMOpenQueue method.</p><dl>
<dd>
<div><pre> HRESULT RemoteQMCloseQueue(
   [in] handle_t hBind,
   [in, out] PCTX_RRSESSION_HANDLE_TYPE* pphContext
 );
</pre></div>
</dd></dl><p><b>hBind: </b>MUST specify an <span><a href="33b1ac82-69ab-413c-9415-cd6f45d77156#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span>
binding handle parameter, as specified in <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>
section <span><a href="../ms-rpce/a01f5886-c485-4bcf-bb23-e0d755510ab7" data-linktype="relative-path">2</a></span>.</p><p><b>pphContext: </b>A PCTX_RRSESSION_HANDLE_TYPE to a
remote opened queue.</p><p><b>Return Values: </b>The method MUST return MQ_OK
(0x00000000) on success; otherwise, it MUST return a failure HRESULT, and the
client MUST treat all failure HRESULTs identically.</p><p><b>MQ_OK</b> (0x00000000)</p><p><b>MQ_ERROR_INVALID_HANDLE</b> (0xC00E0007)</p><p><b>MQ_ERROR_INVALID_PARAMETER</b> (0xC00E0006)</p><p><b>Exceptions Thrown:</b> No exceptions are thrown except
those thrown by the underlying RPC protocol, as specified in [MS-RPCE].</p><p>When processing this call, the server MUST:</p><ul><li><p><span><span> 
</span></span>If <i>pphContext</i> is NULL, return
MQ_ERROR_INVALID_HANDLE(0xC00E0007).</p>
</li><li><p><span><span> 
</span></span>Use <i>pphContext</i> as the <b>OpenQueueEntry</b>.</p>
</li><li><p><span><span> 
</span></span>The server MAY search the <b>rOpenQueueEntryCollection</b> for <b>OpenQueueDescriptorHandle</b>=
<b>OpenQueueEntry.OpenQueueDescriptorHandle</b> and return
MQ_ERROR_INVALID_PARAMETER (0xC00E0006) if the <b>OpenQueueDescriptorHandle</b>
is not found.<a id="Appendix_A_Target_16"></a><a aria-label="Product behavior note 16" href="d6c5ba0a-aaf8-489d-baf2-fdc286b4bea4#Appendix_A_16" data-linktype="relative-path">&lt;16&gt;</a></p>
</li><li><p><span><span> 
</span></span>Remove <b>OpenQueueEntry</b> from <b>rOpenQueueEntryCollection</b>.</p>
</li><li><p><span><span> 
</span></span>Loop over <b>rRemoteReadEntryCollection</b>, and for each entry
where <b>OpenQueueDescriptorHandle</b> = <b>OpenQueueEntry.OpenQueueDescriptorHandle:</b></p>
<ul><li><p><span><span>  </span></span>Cancel
the operation, as specified in <b>RemoteQMCancelReceive</b>.</p>
</li></ul></li><li><p><span><span> 
</span></span>For each queue present in the <b>QueueManager.QueueCollection:</b></p>
<ul><li><p><span><span>  </span></span>For
each <b>OpenQueueDescriptor</b> in <b>Queue.OpenQueueDescriptorCollection:</b></p>
</li><li><p><span><span>  </span></span>If <b>OpenQueueDescriptor.Handle</b>=
<b>OpenQueueEntry.OpenQueueDescriptorHandle</b>, use that <b>OpenQueueDescriptor</b>
for processing.</p>
</li></ul></li><li><p><span><span> 
</span></span>Generate a <span><a href="../ms-mqdmpr/c4ccefa4-d914-47b3-8e39-ad49e66a9d9b" data-linktype="relative-path">Close
Queue</a></span> event with the following parameters:</p>
<ul><li><p><span><span>  </span></span>iQueueDesc:=
reference to <b>OpenQueueDescriptor</b> obtained earlier.</p>
</li></ul></li><li><p><span><span> 
</span></span>Delete the <b>OpenQueueEntry</b>.</p>
</li><li><p><span><span> 
</span></span>Set <i>pphContext</i> to NULL.</p>
</li><li><p><span><span> 
</span></span>Return MQ_OK (0x00000000).</p>
</li></ul></div>