Help and Support
 

powered byLive Search

Comctl32.dll causes access violations after debugging an application

Article ID:255607
Last Review:July 11, 2005
Revision:3.1
This article was previously published under Q255607

SYMPTOMS

After you run an application in the debugger on Microsoft Windows 98 or Microsoft Windows Millennium Edition (Me), unrelated applications on the system may begin to generate access violations in the Comctl32.dll file.

For example, you may see this problem when an animated ToolTip is displayed or when the mouse hovers over a button of a toolbar with the TBSTYLE_FLAT style.

Back to the top

CAUSE

When Comctl32.dll uses a function that is not exported in all versions of system components, it uses the LoadLibrary and GetProcAddress functions to retrieve the address of the function, and then calls the function. This method prevents errors that are associated with static linking of a function that may not be present. In many instances, the function pointer is stored in a static or global variable; once the address is retrieved, it is never retrieved again. This problem occurs, for example, when Comctl32.dll calls the AnimateWindow or TrackMouseEvent function.

When a process is run under a debugger, the Windows 98 or Windows Me operating system provides the address of a thunk function in response to GetProcAddress, rather than the true function address. Unfortunately, Comctl32.dll is a shared DLL, so it is not unloaded when the process terminates. If the function is called the first time in the context of a process that is being debugged, the thunk function address is stored, rather than the true address. When the process that is being debugged terminates, the thunk address is released. The function pointer now stored in the static variable of Comctl32.dll is not NULL and does not point to a valid address. The next time this function pointer is used, an access violation occurs. All processes share the same copy of Comctl32.dll, and therefore this access violation occurs in any application that causes Comctl32.dll to call this function.

This problem occurs only with Comctl32.dll version 5.8x, which comes with Internet Explorer 5.0x because the data segment of this version of the DLL is shared. Previous versions do not share the data segment. This problem has only been observed on Windows 98 and Windows Me, but could also occur on Microsoft Windows 95.

Back to the top

RESOLUTION

It is important to note that this problem occurs only when an application is being debugged. The problem does not normally occur in a user's environment.

You can prevent this problem from occurring by performing the problematic action before running your application in the debugger. For example, cause the problem to occur (for example, cause an animated ToolTip to be displayed) before running your application in the debugger. This will cause the true function address to be loaded and the true function address is used from then on.

Back to the top

STATUS

This behavior is by design.

Back to the top


APPLIES TO
Microsoft Platform Software Development Kit-January 2000 Edition, when used with:
  Microsoft Windows 98 Standard Edition
  Microsoft Windows Millennium Edition

Back to the top

Keywords: 
kbbug kbprb kbctrl kbpending KB255607

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.