3.1.4.7 RemoteQMPurgeQueue (Opnum 6)

The RemoteQMPurgeQueue method removes all messages from the queue.

Before calling this method, the RemoteQMOpenQueue method MUST be called.

 HRESULT RemoteQMPurgeQueue(
   [in] handle_t hBind,
   [in] DWORD hQueue
 );

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

hQueue: A queue handle value acquired from the phQueue parameter of the qmcomm:R_QMOpenRemoteQueue method as specified in [MS-MQMP] section 3.1.4.2.

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)

Exceptions Thrown: Failure HRESULTs returned by this method MAY<18> be thrown as exceptions as well as those thrown by the underlying RPC protocol, as specified in [MS-RPCE].

When processing this call, the server MUST:

  • Look up OpenQueueEntry in the rOpenQueueEntryCollection where OpenQueueEntry.OpenQueueDescriptorHandle= hQueue.

  • If no such entry is found, return MQ_ERROR_INVALID_HANDLE (0xC00E0007).

  • For each queue present in the QueueManager.QueueCollection:

    • For each OpenQueueDescriptor in Queue.OpenQueueDescriptorCollection:

      • IfOpenQueueDescriptor.Handle=RemoteReadEntry.OpenQueueDescriptorHandle, use that OpenQueueDescriptor for processing.

  • Generate a Purge Queue event ([MS-MQDMPR] section 3.1.7.1.7) with the following inputs:

    • iQueue:=QueueReference member of the OpenQueueDescriptor obtained earlier.

  • Return MQ_OK (0x00000000).