CoCreateInstance fails with ERROR_INVALID_NAME (0x8007007b) if Registration-Free COM not done properly

Article translations Article translations
Close Close
Article ID: 948479 - View products that this article applies to.
Expand all | Collapse all
Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Action

Call CoCreateInstance (directly or indirectly) to create an instance of a COM object that is implemented in a module which was built with some Isolated COM settings in its manifest. There are several wrapper classes that could have been used to make the CoCreateInstance (or CoCreateInstanceEx) call indirectly, or you could have a call directly to that function.

Result

The HRESULT return code may be 0x8007007b (ERROR_INVALID_NAME), if the COM sub-system was not able to load the DLL that implements the COM object.

Cause

In cases where the Registration-Free COM was not correctly completed, and the embedded manifest is not correct or complete, the LoadLibrary call may fail. Ole32 attempts to load the DLL as part of the process of creating the object, but an incorrect manifest may cause it to return STATUS_OBJECT_NAME_INVALID (0xc0000033). This error gets propagated back to the return from CoCreateInstance as ERROR_INVALID_NAME (0x8007007b). This may be misleading, since the path and filename of the DLL may be perfectly correct.

Resolution



If the Registration-Free COM is desired, it should be implemented correctly. Here are some articles that may be helpful in correctly implementing this feature:

Registration-Free Activation of COM Components: A Walkthrough
How to: Configure .NET-Based Components for Registration-Free Activation
Escape DLL Hell: Simplify App Deployment with ClickOnce and Registration-Free COM -- MSDN Magazine, April 2005

If Reg-Free COM was not intended, there may be some properties unintentionally specified in the Isolated COM page of the Manifest Tool configuration properties for the project. The "Type Library File" (/tlb) and "Component File Name" (/dll) properties will result in <file>, <comClass>, <comInterfaceExternalProxyStub>, and such tags being added to the assembly manifest embedded in the DLL. Removing the unwanted properties and then rebuilding the project should resolve the issue.

More Information

Here are some other useful web logs on the subject:
Junfeng Zhang's Windows Programming Notes : Registration Free COM/.Net interop
Mikhail Arkhipov (MSFT)'s WebLog : Registration-free COM

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

Properties

Article ID: 948479 - Last Review: January 29, 2008 - Revision: 1.3
APPLIES TO
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Service Pack 1
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Team Edition for Database Professionals
  • Microsoft Visual Studio 2005 Team Edition for Software Architects
  • Microsoft Visual Studio 2005 Team Edition for Software Developers
  • Microsoft Visual Studio 2005 Team Edition for Software Testers
  • Microsoft Visual Studio 2005 Team Suite
  • Microsoft Visual Studio 2005 Express Edition
Keywords: 
kbnomt kbrapidpub KB948479

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com