DOCUMENT:Q194180 28-JUN-2001 [visualc] TITLE :FIX: Unregistering ATL Server Causes Access Violation PRODUCT :Microsoft C Compiler PROD/VER:WINDOWS:3.0 OPER/SYS: KEYWORDS:kberrmsg kbservicepack kbActiveX kbCOMt kbRegistry kbVC600bug kbATL300 kbATL300bug kbVS ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - The Microsoft Active Template Library (ATL) 3.0, used with: - Microsoft Visual C++, 32-bit Enterprise Edition, version 6.0 - Microsoft Visual C++, 32-bit Professional Edition, version 6.0 - Microsoft Visual C++, 32-bit Learning Edition, version 6.0 ------------------------------------------------------------------------------- SYMPTOMS ======== Unregistering an ATL DLL or .exe file that was built with a version of Visual C++ prior to 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 machine. Running "REGSVR32.EXE /U" to unregister an ATL DLL might display the following error message: DllUnregisterServer in failed. Return code was: 0xc0000005 Running an ATL .exe file with the "/Unregserver" switch may display a dialog box titled "OleMainThreadWndName: - 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. 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. 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 additional information about this, click the article number below to view the article in the Microsoft Knowledge Base: Q244955 PRB: MinDependency Project May Need to Include Atl.dll - Rebuild your server with Visual C++ 6.0. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base: Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed Additional query words: ====================================================================== Keywords : kberrmsg kbservicepack kbActiveX kbCOMt kbRegistry kbVC600bug kbATL300 kbATL300bug kbVS600sp2 kbFAQ kbVS600SP1 kbVS600sp3fix kbGrpDSMFCATL Technology : kbVCsearch kbAudDeveloper kbATLsearch Version : WINDOWS:3.0 Issue type : kbbug Solution Type : kbfix ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.