Microsoft KB Archive/194180

= Unregistering an ATL DLL or .exe file that was built with a version of Visual C++ prior to Visual C++ 6.0 might result in an access violation =

Article ID: 194180

Article Last Modified on 9/2/2005

-

APPLIES TO

 Microsoft ActiveX Template Library 3.0, when used with:  Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Professional Edition

 Microsoft Visual C++ 6.0 Standard Edition 

-

<div class="notice_section">

This article was previously published under Q194180

<div class="symptoms_section">

SYMPTOMS
Unregistering an ATL DLL or .exe file that was built with a version of Microsfot Visual C++ prior to Microsoft Visual C++ 6.0 might result in an access violation when Atl.dll (version 3.00.8168) that ships with Visual C++6.0 is installed on the computer.

Running "REGSVR32.EXE /U" to unregister an ATL DLL might display the following error message:

DllUnregisterServer in <component.dll> failed. Return code was: 0xc0000005

Running an ATL .exe file with the "/Unregserver" switch may display a dialog box titled "OleMainThreadWndName: <server.exe> - Application Error", with the following error message:

The instruction at 0x00000000 referenced memory at 0x00000000. The memory could not be read.

The ATL server has to be of build type Release MinSize or Unicode Release MinSize.

<div class="cause_section">

CAUSE
In the version of Atl.dll that comes with Visual C++ 6.0, the _ATL_OBJMAP_ENTRY structure has an additional member called "pfnGetCategoryMap". During unregistration, AtlModuleUnregisterServerEx tries to access this member, which does not exist for ATL servers built prior to Visual C++ 6.0, and the access violation occurs.

<div class="resolution_section">

RESOLUTION
To work around this problem, use one of the following options:  Rebuild your server with Release MinDependency. This statically links in all the code that was in Atl.dll, so your server isn't dependent on it. Even for a 'Release MinDependency' atl.dll may need to be shipped. For more information about this, click the following article number to view the article in the Microsoft Knowledge Base:

244955 ATL projects built for MinDependency need Atl.dll if the projects use ATL control containment code in Visual C++ 6.0

</li> Rebuild your server with Visual C++ 6.0.</li></ul>

<div class="status_section">

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

This bug was corrected in Visual Studio 6.0 Service Pack 3. <div class="references_section">