FIX: MSMQMessage.Body (Get_Body) operation fails with E_NOINTERFACE (236155)



The information in this article applies to:

  • Microsoft Message Queue Server (MSMQ) 1.0
  • Microsoft Message Queuing 2.0
  • Microsoft Windows NT Server 4.0
  • Microsoft Windows NT Server 4.0 SP6
  • Microsoft Windows NT Server 4.0 SP6a
  • Microsoft Windows NT Workstation 4.0
  • Microsoft Windows NT Workstation 4.0 SP6
  • Microsoft Windows NT Workstation 4.0 SP6a

This article was previously published under Q236155

SYMPTOMS

When a component has only a native interface method (the component implements the IUnknown method, but not the IDispatch), the MSMQMessage.get_Body method fails with the following error message:
0x80000004 No such interface supported.

CAUSE

This error message is returned erroneously. The resulting VARIANT needs to have the IUnknown interface pointer to the object, if the function is allowed to return. If the _com_ptr_t interface pointer (Visual C++ smart pointer) is used, the result causes an error, and the value is not propagated to the VARIANT.

RESOLUTION

To resolve this problem, obtain the latest service pack for Windows NT 4.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

152734 How to Obtain the Latest Windows NT 4.0 Service Pack

WORKAROUND

To work around this problem if you have an earlier service pack installed, use regular (non-smart) interface pointers. For example, if you are using a IMSMQMessagePtr smart pointer, use the IMSMQMessage interface pointer instead. In the following example, IMyObjectPtr is a smart pointer to the object that you want to retrieve:
IMyObjectPtr pMyObject = NULL;
IMSMQMessagePtr pMsg = pQueue.ReceiveCurrent();

IMSMQMessage* pTempMessage = pMsg;

VARIANT vtBody;
HRESULT hr = pMsg->get_Body(vtBody);

if (hr == E_NOINTERFACE) {
   pMyObject = vtBody.punkVal;
}
				
In this example, the E_NOINTERFACE error is ignored. This is the only valid time that you can ignore the HRESULT. If you receive any other error, you must handle it properly, and consider the vtBody returned invalid.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Windows NT 4.0 Service Pack 6. This problem has also been corrected in Windows 2000.

MORE INFORMATION

Steps to Reproduce Behavior

Create a component that has only a native interface that implements the IPersistStreamInit method. Send this through MSMQ, and attempt to retrieve the object from the resulting message.

Modification Type:MajorLast Reviewed:4/20/2005
Keywords:kbBug kbfix kbMSMQ100fix kbMSMQ200fix KB236155