FIX: Invalid Page Fault in Msvcrt.dll

ID: Q190536


The information in this article applies to:
  • Microsoft Visual C++, 32-bit Editions, version 6.0


SYMPTOMS

After you install the run-time 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.


CAUSE

One possible cause of this error is that the application has written past the block of memory owned by a particular object. The small-block heap memory manager that shipped with the Visual C++ 6.0 run-time libraries incorporates heap control structures within the small-block heap. Overwriting the memory block will change 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 experiencing this problem in their third-party applications, Microsoft has released a new C-Run-time Library DLL, msvcrt.dll, which implements two heap managers, the Visual C++ 5 compatible heap manager and the Visual C++ 6 compatible heap manager. It detects with which Visual C++ version your application is built and uses the appropriate heap manager for that application. If this version is 6.0 or greater, the Visual C++ 6 compatible heap manager is used and if it is earlier than version 6.0,the Visual C++ 5 compatible heap is used.

Visual Studio 6.0 users can get this new Msvcrt.dll by installing the latest Microsoft Visual Studio Service Pack. Non-Visual Studio users should install the Microsoft Libraries Update.


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


MORE INFORMATION

The small-block heap comprises allocations that are less than 1K in size. Bugs of this nature might have behaved differently in older versions of the C run-time library because the control structures were located in a different and separate location in memory. Often, coding errors like this resulted in the corruption of another block of memory and possibly a crash. The sequence of events leading to an access violation will be different when you use the Visual C++ 6.0 C run-time libraries.

You can control problems like this 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.

Keywords : kbservicepack kbCRT kbVC600 kbVS600sp2 kbVS600sp2bug kbVS600sp2fix kbVS600SP1 kbVS600sp3fix
Version : winnt:6.0
Platform : winnt
Issue type : kbbug


Last Reviewed: June 25, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.