Article ID: 190536 - View products that this article applies to.
This article was previously published under Q190536
After you install the C Runtime libraries (Msvcrt.dll) from Visual C++ 6.0 on your computer, the applications that previously ran correctly fail and an application error similar to the following appears:
<Application Name> caused an invalid page fault in module MSVCRT.DLL at XXXX:XXXXXXXX.
One possible cause of this error is that the application has written past the block of memory that is owned by a particular object. The small-block heapmemory manager that ships with the Visual C++ 6.0 run-time libraries incorporates heap control structures within the small-block heap. Overwriting the memory block changes small-block heap pointer addresses, effecting a bad pointer and possibly a fault in Msvcrt.dll when the pointer is referenced.
Application vendors need to ensure that their applications are using the C run-time small-block heap correctly.
To help customers who are experiencing this problem in their third-party applications, Microsoft has released a new C Runtime dynamic-link library (DLL), Msvcrt.dll, which implements two heap managers: the Visual C++ version 5.0-compatible heap manager and the Visual C++ version 6.0-compatible heap manager. Msvcrt.dll detects which version of Visual C++ your application is built with, and uses the appropriate heap manager for that application. If the version is Visual C++ 6.0 or greater, the Visual C++ 6.0-compatible heap manager is used; if the version is earlier than version 6.0, the Visual C++ 5.0-compatible heap is used.
Visual Studio 6.0 users can get the new Msvcrt.dll file by installing the latest Microsoft Visual Studio Service Pack. If you are not using Visual Studio, install the Microsoft Libraries Update; for additional information, see the following article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/197298/ )Microsoft libraries update: What, where, why
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/194022/ )Visual Studio 6.0 service packs, what, where, why
(http://support.microsoft.com/kb/194295/ )How to tell that a Visual Studio service pack is installed
The small-block heap comprises allocations that are less than 1K in size. Bugs of this nature might behave differently in older versions of the C run-time library because the control structures are located in a different and separate location in memory. Often, these types of coding errors result in the corruption of another block of memory and possibly a crash. The sequence of events that lead to an access violation are different when you use the Visual C++ 6.0 C Runtime libraries.
You can control these types of problems by using the debug heap. Please see the online documentation titled, "Using the Debug Heap." You need to enable the debug heap by calling _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF |_CRTDBG_CHECK-_ALWAYS_DF) at process initialization in a debug build of your application.
Article ID: 190536 - Last Review: October 3, 2005 - Revision: 3.3
Contact us for more help
Connect with Answer Desk for expert help.