Microsoft KB Archive/68825

INF: Tracking Unrecoverable Application Errors Without CVW ID Number: Q68825

3.00 WINDOWS

Summary:

If an application causes an unrecoverable application error (UAE), and this behavior is not duplicated when the application runs under CodeView for Windows (CVW), it can be very difficult to isolate the problem.

If a debugging terminal is available, a call to OutputDebugString will put a message on the terminal. However, if no additional hardware is in place, the application can leave data regarding its path of execution by calling WriteProfileString to modify the WIN.INI file.

More Information:

Consider the following code fragment:

case WM_MOUSEMOVE: WriteProfileString (“TestApp”, “Debug”, “Entering WM_MOUSEMOVE”); MousePos[iGlobalIndex] = lParam; WriteProfileString (“TestApp”, “Debug”, NULL); break;

Assume that it is unclear whether the UAE happens in this code (for example, if iGlobalIndex takes on an invalid value). This has not occurred when running in the CVW debugger, or it takes so long to reproduce under CVW that the debugger is not useful.

The next time the UAE occurs, if the [TestApp] section of the WIN.INI file has the following line

Debug=Entering WM_MOUSEMOVE

the UAE occurred in the bracketed code. Otherwise, the line would be deleted from WIN.INI. This evidence would be helpful in tracking and correcting the bug.

In this particular case, the performance hit can be quite severe because the WM_MOUSEMOVE message is sent quite often and updating WIN.INI requires a write to the disk. However, by testing an appropriate, but less common, message (such as WM_LBUTTON*) first, the worst case slowdown shown in the example above can be avoided.