BUG: Browseh In-Process COM Sample Does Not Expose Entry Points (258942)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0

This article was previously published under Q258942

SYMPTOMS

After you build and register the Browseh sample in the Platform SDK, when you try to run the Microsoft Visual Basic client application that is included with the sample, you may not see any results. When you attempt to create the Browseh COM component from another client, such as OLEVIEW, you may receive the following error message:

Microsoft Windows NT 4.0
CoGetClassObject failed. Class not registered. REGDB_E_CLASSNOTREG ($80040154)
Microsoft Windows 2000
CoGetClassObject failed. Error in the DLL CO_E_ERRORINDLL ($800401f9)

CAUSE

Because of how the sample is currently built, no functions are exported from the Browseh COM in-process server. At a minimum, you must export the DllGetClassObject and DllCanUnloadNow functions. The sample has a Browseh.def file, but it does not export these functions. In addition, the makefile ignores Browseh.def in the Link statement.

RESOLUTION

To resolve this problem, perform the following steps:
  1. In the Browseh.def file, replace the Exports section with the following code:
    EXPORTS        
    	DllGetClassObject  PRIVATE
    	DllCanUnloadNow  PRIVATE
    					
  2. In the makefile, add the following code to the Link line
    /DEF:browseh.def
    						
    so that the Link line appears as follows:
    LINK = $(link)
    LINKFLAGS = $(linkdebug) $(guilflags) -dll -entry:_DllMainCRTStartup$(DLLENTRY) /DEF:browseh.def\ 
    					
  3. Rebuild the sample.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Follow the sample instructions to build and register the sample.

    NOTE: The Browseh.dll file is not a self-registering DLL, so use the Browseh.reg file to register Browseh.dll. Make sure that you update the paths to Browseh.dll, Browseh.tlb, and MyDisp.tlb correctly in Browseh.reg.
  2. In Microsoft Visual Basic, open the VB.vbp file, which loads the sample's client project.
  3. Press the F5 key to run the Visual Basic client.
  4. Click Choose Type Library.
  5. In the Choose Type Library dialog box, click any type library file, and then click OK. Notice that nothing happens. The simple Visual Basic client captures the error that is raised but does nothing in the error handler.
  6. To verify that DllGetClassObject and DllCanUnloadNow are not exported from Browseh.dll, you can use a tool such as Dumpbin.exe. At the command prompt, type the following line from the Browseh.dll folder:

    dumpbin browseh.dll /exports

    A list of exported functions is displayed but does not include DllGetClassObject and DllCanUnloadNow.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbbug kbpending KB258942