Microsoft KB Archive/236155

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

Article ID: 236155

Article Last Modified on 2/23/2007

-

APPLIES TO


 * Microsoft Message Queue Server 1.0
 * Microsoft Message Queuing 2.0
 * Microsoft Windows NT Server 4.0 Standard Edition
 * Microsoft Windows NT 4.0 Service Pack 6
 * Microsoft Windows NT 4.0 Service Pack 6a
 * Microsoft Windows NT Workstation 4.0 Developer Edition
 * Microsoft Windows NT Workstation 4.0 Developer Edition
 * Microsoft Windows NT Workstation 4.0 Developer Edition

-



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.



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.

Additional query words: MSMQ COM Pointer E_NOINTERFACE

Keywords: kbbug kbfix kbmsmq100fix kbmsmq200fix KB236155

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.