3.10.4.1.27 Delete (Opnum 33)

The Delete method is received by the server in an RPC_REQUEST packet. In response, the server deletes the referenced queue.

 HRESULT Delete();

This method has no parameters.

Return Values: The method MUST return S_OK (0x00000000) on success or an implementation-specific error HRESULT on failure.

When processing this call, the server MUST abide by the following contract:

  • Generate Update QueueFormatName event (section 3.10.6.1).

  • If rStatus is an error HRESULT return an error HRESULT, and take no further action.

  • If the QueueFormatName instance variable is NULL:

    • Return an error HRESULT, and take no further action.

  • If the QueueFormatName instance variable identifies more than one queue or contains an HTTP or multicast format name:

    • Return an error HRESULT, and take no further action.

  • Look up the ApplicationQueue, referred to as iQueueRef, identified by the QueueFormatName instance variable.

    • If ApplicationQueue does not exist:

      • Return an error HRESULT, and take no further action.

  • Define IsLocal as a BOOLEAN value that equals True if the identified ApplicationQueue belongs to the QueueCollection of the local QueueManager. Otherwise, IsLocal equals False.

  • Define IsPublic as a BOOLEAN value that equals True if the identified ApplicationQueue has QueueType set to Public. Otherwise, IsPublic equals False.

  • If IsLocal equals False and IsPublic equals False:

    • Return an error HRESULT, and take no further action.

  • If IsLocal equals True and IsPublic equals False:

    • Perform an access check by invoking the Access Check Algorithm ([MS-DTYP] section 2.5.3.2) with the following parameters:

      • SecurityDescriptor: iQueueRef.Security.

      • Token: the security token of the caller.<46>

      • Access Request mask: MQSEC_DELETE_QUEUE as defined in Section 2.2.24 of [MS-MQMQ].

      • Object Tree: NULL.

      • PrincipalSelfSubst SID: NULL.

    • If the Access Check Algorithm does not return success:

      • Return an error HRESULT, and take no further action.

  • Generate the Delete Queue event as defined in [MS-MQDMPR] section 3.1.7.1.4 with the following arguments:

    • iQueue = iQueueRef.

    • iSkipDirectory = False.

    • If the rStatus return value from Delete Queue is not Success:

      • Return an error HRESULT, and take no further action.

  • Reset all the instance variables to the values described in the initialization section of the MSMQQueueInfo object.

  • Return S_OK (0x00000000), and take no further action.