Microsoft KB Archive/322909

= FIX: DLL that uses ATL CImage class may cause a deadlock in a process =

Article ID: 322909

Article Last Modified on 9/27/2005

-

APPLIES TO

 The Microsoft Active Template Library (ATL) 7.0, when used with:  Microsoft Visual Studio .NET 2002 Enterprise Architect

 Microsoft Visual Studio .NET 2002 Enterprise Developer

 Microsoft Visual Studio .NET 2002 Professional Edition

 Microsoft Visual Studio .NET 2002 Academic Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q322909

<div class="symptoms_section">

SYMPTOMS
A DLL that is using the Active Template Library (ATL) CImage class may cause a deadlock when it is unloaded from a process or when the loading process shuts down.

<div class="cause_section">

CAUSE
This problem occurs because the CImage class initializes and then shuts down GDI+ by using the static nested class CInitGDIPlus. This class initializes GDI+ before any CImage function that requires GDI+ is called. GDI+ is shut down by calling GdiplusShutdown when the CInitGDIPlus class is destructed. CInitGDIPlus is a static class that is destructed in a DLL in the context of DllMain. The documentation states that you cannot call GdiplusShutdown in DllMain.

<div class="resolution_section">

Service pack Information
To resolve this problem, obtain the latest service pack for Microsoft Visual Studio .NET. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

837234 List of bugs that are fixed in Visual Studio .NET 2002 Service Pack 1

Hotfix information
For more information about this hotfix, click the following article number to view the article in the Microsoft Knowledge Base:

326459 COleDateTime comparison asserts or returns incorrect value

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article. This problem was first corrected in Visual Studio .NET 2002 Service Pack 1.

<div class="moreinformation_section">

Steps to Reproduce the Behavior

 * 1) Create an ATL DLL project named  .htm, and then insert an ActiveX control.
 * 2) Add a CImage member to the ActiveX control class.
 * 3) Call CImage::Load in the ActiveX control class constructor.
 * 4) View the .htm page that you created for the control ( .htm) in Microsoft Internet Explorer.
 * 5) Quit Internet Explorer. You should experience one of the following conditions:
 * 6) * You cannot start Internet Explorer again.

-or-
 * 1) * The IExplore.exe process still appears in Task Manager.

Keywords: kbbug kbfix kbqfe kbvs2002sp1sweep kbvs2002sp1fix kbhotfixserver KB322909

-

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

© Microsoft Corporation. All rights reserved.