3.12.4.2.2 Handle (Opnum 8)

The Handle method is received by the server in an RPC_REQUEST packet. In response, the server sets the QueueHandle instance variable that identifies the OpenQueueDescriptor. This method is internally used by other MSMQ objects like MSMQMessage.

 [propput] HRESULT Handle(
   [in] VARIANT varHandle
 );

varHandle: A VARIANT that contains a VT_I8 value that identifies the OpenQueueDescriptor.

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 follow these guidelines:

  • Set the QueuePathName instance variable to NULL.

  • Set the DirectoryPath instance variable to NULL.

  • Set the OpenQueueDescriptor instance variable to NULL.

  • If the varHandle input parameter value equals NULL or INVALID_HANDLE_VALUE:

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

  • Else:

    • For each Queue in QueueManager.QueueCollection for the local QueueManager:

      • Refer to Queue being currently enumerated as aQueue.

      • For each OpenQueueDescriptor in aQueue.OpenQueueDescriptorCollection:

        • Refer to OpenQueueDescriptor being currently enumerated as aOpenQueueDescriptor.

        • If aOpenQueueDescriptor.Handle = varHandle:

          • Set the OpenQueueDescriptor instance variable to aOpenQueueDescriptor.

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

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