3.1.4.4 RemoteQMCloseQueue (Opnum 3)

The RemoteQMCloseQueue method closes a PCTX_RRSESSION_HANDLE_TYPE that was previously opened by using a call to the RemoteQMOpenQueue method. The client MUST call this method to reclaim resources on the server allocated by the RemoteQMOpenQueue method.

 HRESULT RemoteQMCloseQueue(
   [in] handle_t hBind,
   [in, out] PCTX_RRSESSION_HANDLE_TYPE* pphContext
 );

hBind: MUST specify an RPC binding handle parameter, as specified in [MS-RPCE] section 2.

pphContext: A PCTX_RRSESSION_HANDLE_TYPE to a remote opened queue.

Return Values: 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.

MQ_OK (0x00000000)

MQ_ERROR_INVALID_HANDLE (0xC00E0007)

MQ_ERROR_INVALID_PARAMETER (0xC00E0006)

Exceptions Thrown: No exceptions are thrown except those thrown by the underlying RPC protocol, as specified in [MS-RPCE].

When processing this call, the server MUST:

  • If pphContext is NULL, return MQ_ERROR_INVALID_HANDLE(0xC00E0007).

  • Use pphContext as the OpenQueueEntry.

  • The server MAY search the rOpenQueueEntryCollection for OpenQueueDescriptorHandle= OpenQueueEntry.OpenQueueDescriptorHandle and return MQ_ERROR_INVALID_PARAMETER (0xC00E0006) if the OpenQueueDescriptorHandle is not found.<16>

  • Remove OpenQueueEntry from rOpenQueueEntryCollection.

  • Loop over rRemoteReadEntryCollection, and for each entry where OpenQueueDescriptorHandle = OpenQueueEntry.OpenQueueDescriptorHandle:

    • Cancel the operation, as specified in RemoteQMCancelReceive.

  • For each queue present in the QueueManager.QueueCollection:

    • For each OpenQueueDescriptor in Queue.OpenQueueDescriptorCollection:

    • If OpenQueueDescriptor.Handle= OpenQueueEntry.OpenQueueDescriptorHandle, use that OpenQueueDescriptor for processing.

  • Generate a Close Queue event with the following parameters:

    • iQueueDesc:= reference to OpenQueueDescriptor obtained earlier.

  • Delete the OpenQueueEntry.

  • Set pphContext to NULL.

  • Return MQ_OK (0x00000000).