<div class="content" name="R_CloseQueue" uuid="e480114a-587f-4110-b03b-7a6188cca307"><p>The R_CloseQueue method closes a <span><a href="d82f6d41-c569-478b-aa41-e8c57832866d" data-linktype="relative-path">QUEUE_CONTEXT_HANDLE_SERIALIZE (section 2.2.4.2)</a></span>
handle that was previously opened by using a call to the R_OpenQueue (Opnum
2) (section <span><a href="b4b3001c-f2ff-4a17-9830-7b21af371dc4" data-linktype="relative-path">3.1.4.2)</a></span> method or
the R_OpenQueueForMove (Opnum 11) (section <span><a href="960e383b-d0c9-482f-9617-2507d1dc0487" data-linktype="relative-path">3.1.4.11)</a></span> method.</p><dl>
<dd>
<div><pre> HRESULT R_CloseQueue(
   [in] handle_t hBind,
   [in, out] QUEUE_CONTEXT_HANDLE_SERIALIZE* pphContext
 );
</pre></div>
</dd></dl><p><b>hBind: </b>MUST specify an <span><a href="b23ea276-dfad-4083-bc48-d0f8a40255fd#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>MUST be set by the client to the <b>QUEUE_CONTEXT_HANDLE_SERIALIZE</b>
handle to be closed. The handle MUST have been returned by the server in the <i>pphContext</i>
parameter of a prior call to the <b>R_OpenQueue</b> method or the <b>R_OpenQueueForMove</b>
method and MUST NOT have been closed through a prior call to R_CloseQueue. This
value MUST NOT be NULL. If the server returns MQ_OK, it MUST set this value to
NULL.</p><p><b>Return Values: </b>On success, this method MUST return
MQ_OK (0x00000000).</p><p>If an error occurs, the server MUST return a failure <b>HRESULT</b>,
and the client MUST treat all failure <b>HRESULTs</b> identically.</p><p>Exceptions Thrown:</p><p>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>Find the corresponding <b>OpenQueueDescriptor</b> ADM element
instance by comparing the <i>pphContext</i> parameter with the <b>Handle</b>
ADM attribute for all <b>OpenQueueDescriptor</b> ADM element instances
maintained by the local <b>QueueManager</b> ADM element instance.</p>
</li><li><p><span><span> 
</span></span>If not found, return a failure <span><a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a></span>.</p>
</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> (<span><a href="../ms-mqdmpr/5eafe0a6-a22f-436b-a0d9-4cbc25c52b47" data-linktype="relative-path">[MS-MQDMPR]</a></span>
section 3.1.7.1.6) event with the following inputs:</p>
<ul><li><p><span><span>  </span></span><i>iQueueDesc</i>
:= The found <b>OpenQueueDescriptor</b> ADM element instance.</p>
</li></ul></li><li><p><span><span> 
</span></span>Find all entries in the <span><a href="9712f072-8179-43ba-861c-d9c50ab0df4f" data-linktype="relative-path">PendingRequestTable (section 3.1.1.3)</a></span>
ADM element that contain the <i>pphContext</i> parameter, and remove these
entries.</p>
</li><li><p><span><span> 
</span></span>Set the <i>pphContext</i> parameter to NULL.</p>
</li><li><p><span><span> 
</span></span>Return MQ_OK (0x00000000).</p>
</li></ul></div>