3.10.4.1.28 Open (Opnum 34)

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

 HRESULT Open(
   [in] long Access,
   [in] long ShareMode,
   [out, retval] IMSMQQueue4** ppq
 );

Access: A long that corresponds to one of the MQACCESS (section 2.2.2.3) enumeration values.

ShareMode: A long that corresponds to one of the MQSHARE (section 2.2.2.2) enumeration values.

ppq: A pointer to an IMSMQQueue4 interface pointer that the server MUST set with an instance object of MSMQQueue that represents the open queue.

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 Access input parameter value is equal to MQ_SEND_ACCESS (0x00000002) and the ShareMode input parameter value is not equal to MQ_DENY_NONE (0x00000000):

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

  • If the QueueFormatName instance variable contains an HTTP or multicast format name, or identifies more than one queue, and the Access input parameter is not equal to MQ_SEND_ACCESS (0x00000002):

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

  • Generate the Open Queue event as described in [MS-MQDMPR] section 3.1.7.1.5 with the following parameters:

    • iFormatName = QueueFormatName

    • iRequiredAccess = Access

    • iSharedMode = ShareMode

  • If the rStatus returned by the event is not Success:

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

  • Create an MSMQQueue instance with the OpenQueueDescriptor returned from the call to the Open Queue event, and set the ppqueue output parameter to the instantiated MSMQQueue instance.

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