Microsoft KB Archive/190536

= FIX: You receive an "invalid page fault in module MSVCRT.DLL" error message after you install the run-time libraries from Visual C++ 6.0 =

Article ID: 190536

Article Last Modified on 10/3/2005

-

APPLIES TO


 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q190536



SYMPTOMS
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:

 caused an invalid page fault in module MSVCRT.DLL at XXXX:XXXXXXXX.



CAUSE
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.



RESOLUTION
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:

197298 Microsoft libraries update: What, where, why



STATUS
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:

194022 Visual Studio 6.0 service packs, what, where, why

194295 How to tell that a Visual Studio service pack is installed



MORE INFORMATION
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.

Additional query words: SP3 crt msvcirt

Keywords: kberrmsg kbbug kbfix kbcrt kbqfe kbvs600sp2fix kbvs600sp3fix kbhotfixserver KB190536

-

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

© Microsoft Corporation. All rights reserved.