Microsoft KB Archive/82710

= Causes of General Protection Faults and Troubleshooting Tips =

Article ID: 82710

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Windows 95
 * Microsoft Windows 98 Standard Edition

-



This article was previously published under Q82710



If this article does not describe the error message that you are receiving, view the following Microsoft Knowledge Base article to view more articles that describe error messages:

315854 Windows 98 and Windows Me Error Message Resource Center



SUMMARY
Intel 80286, 80386, and 80486 CPUs can detect when a program does something wrong. The most common problems are stack faults, invalid instructions, divide errors (divide by zero), and general protection faults. These generally indicate nonstandard code in a program.



Possible Fault Types
The following faults can occur in a Windows-based program, in Windows itself, or in a Windows device driver (for example, a video adapter driver).

Stack Fault (Interrupt 12)
Reasons for a stack fault include:
 * An instruction tries to access memory beyond the limits of the Stack segment (POP, PUSH, ENTER, LEAVE, or a stack relative access: MOV AX, [BP+6]).
 * Loading SS with a selector marked not present, but otherwise valid (this should not happen under Windows).

Stack faults are always fatal to the current program in Windows.

Invalid Instruction (Interrupt 6)
The CPU detects most invalid instructions, and generates an interrupt.

This is always fatal to the program. This should never happen, and is usually caused by running data instead of code.

Divide Error (Interrupt 0)
This occurs when the destination register cannot hold the result of a divide operation. This could be caused by an attempt to divide by zero, or a divide overflow.

General Protection Fault (Interrupt 13)
All protection violations that do not cause another exception cause a general protection exception. This includes, but is not limited to:
 * Exceeding the segment limit when using the CS, DS, ES, FS, or GS segments. This is a very common problem in programs; it is usually caused by miscalculating how much memory is required in an allocation.
 * Transferring execution to a segment that is not executable (for example, jumping to a location that contains garbage).
 * Writing to a read-only or a code segment.
 * Loading a bad value into a segment register.
 * Using a null pointer. A value of 0 is defined as a null pointer. In Protected mode, it is always invalid to use a segment register that contains 0.

Troubleshooting General Protection Faults
First, narrow down the source of the error. Because General Protection faults can be caused by software or hardware, the first step is to restart your computer in Safe mode. Restarting in Safe mode allows you to test your computer in a state in which only essential components of Windows are loaded. If you restart your computer in Safe mode and the error message does not occur, the origin is more likely to be a driver or program. If you restart in Safe mode and then test your computer and the error message does occur, the issue is more likely to be hardware or damaged Windows core files.  For Windows 95, restart your computer, press F8 when you see the &quot;Starting Windows 95&quot; message, and then choose Safe Mode.

For Windows 98, restart your computer, press and hold down the CTRL key until you see the Windows 98 Startup menu, and then choose Safe Mode.  Test your computer in Safe mode. If the error does not occur, use the appropriate steps below for your operating system. If the error does occur, there may be a problem with your Windows installation or you may be experiencing a symptom of faulty hardware. See the &quot;Test Hardware&quot; section of this article.

Windows 98
After your computer restarts in Safe mode, use the System Configuration Utility tool (Msconfig.exe) to minimize conflicts that may be causing the problem:  

 Click Start, point to Programs, point to Accessories, point to System Tools, and then click System Information. On the Tools menu, click System Configuration Utility. On the General tab, click Selective Startup, and then click to clear the following check boxes: <ul> Process Config.sys File</li> Process Autoexec.bat File</li> Process Winstart.bat File (if available)</li> Process System.ini File</li> Process Win.ini File</li> Load Startup Group Items</li></ul> </li> Click OK, and then restart your computer normally when you are prompted. After you restart and test your computer, if you still do not receive the error message, continue with the next steps.</li> Run the System Configuration Utility tool, click to select one item in the Selective Startup box, click OK, and then restart your computer and test.</li> Continue this process until all of the items in the Selective Startup box are selected. If you select an item and your issue reoccurs, click the tab of the corresponding item in Selective Startup, clear half of the check boxes, click OK, and then restart your computer. Continue this process until you narrow down the setting that is causing your problem.</li> If you can restart your computer successfully when all items are checked, run the System Configuration Utility tool, click to select Normal Startup, click OK, and then restart your computer.</li></ol>

For additional information about using Msconfig.exe, click the article number below to view the article in the Microsoft Knowledge Base:

192926 How to Perform Clean-Boot Troubleshooting for Windows 98

Windows 95
The following steps can help you to determine if the problem that you are experiencing is due to the real-mode configuration of your computer. This could include drivers that are loaded from your Config.sys and Autoexec.bat files. <ol style="list-style-type: lower-alpha;"> 

</li> Restart your computer. When the &quot;Starting Windows 95&quot; message is displayed, press F8, and then click Step-By-Step Confirmation from the Startup menu.</li> When you are prompted, load the following items (if you are prompted to load any other items, press N): <ul> Dblspace driver.</li> Himem.sys.</li> Ifshlp.sys.</li> <li>Dblbuff.sys.</li> <li>Load the Windows 95 graphical user interface (GUI), choosing to load all Windows drivers.</li></ul>

NOTE: Windows 95 does not require the Config.sys and Autoexec.bat files, but some tools installed on the computer may require them. You should never rename the Config.sys and Autoexec.bat files until you perform a successful interactive boot to verify that they are not needed.

If the clean boot of your real-mode configuration eliminates the issue, isolate the conflict with a terminate-and-stay-resident (TSR) or real-mode device driver by using the Step-By-Step Confirmation function.

Load Windows 95 by booting to a command prompt and starting Windows 95 by typing win, holding down the SHIFT key for the duration of the boot. This prevents any programs from loading automatically at startup.

If the issue is resolved by preventing programs from loading at startup, investigate the following possible sources.</li></ol>

The Winstart.bat File

The Winstart.bat file is used to load TSRs that are required for Windows-based programs and are not needed in MS-DOS sessions.

For additional information the Winstart.bat file, click the article number below to view the article in the Microsoft Knowledge Base:

134402 Some TSRs Moved from Autoexec.bat to Winstart.bat During Setup

The Startup Group

If the issue is resolved by bypassing the Startup group, remove each of the programs from the Startup group individually to isolate the program that is causing the problem.

The Run Key in the Registry

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

You can prevent programs from loading by removing the program's string from the following registry keys:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices

Programs may also be loading from the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

The Win.ini File

The &quot;load=&quot; and &quot;run=&quot; lines in the [Windows] section of this file can start programs automatically. See the following section for more information.

Test Windows Configuration Files

To test the Windows configuration files, use the following steps: <ol> <li>

</li> <li>Boot to a command prompt.</li> <li>Rename the Win.ini file by typing the following command:

ren c:\windows\win.ini *.bak

</li> <li>Start Windows 95 by typing win. If this procedure corrects the problem, ensure that the &quot;load=&quot; and &quot;run=&quot; lines in the [Windows] section of the Win.ini file are either blank or preceded with a semicolon to prevent the items from loading.</li> <li>Rename the System.ini file by typing the following command:

ren c:\windows\system.ini *.bak

</li> <li>Windows 95 requires a System.ini file to load the graphic user interface. Replace the original file by typing the following command:

copy c:\windows\system.cb c:\windows\system.ini

NOTE: Starting Windows 95 with the System.cb file does not load a driver for the mouse. Edit the new System.ini file, adding the following lines:

[386Enh]

mouse=*vmouse, msmouse.vxd

[boot]

drivers=mmsystem.dll

mouse.drv=mouse.drv

</li> <li>Start Windows 95 by typing win at the command prompt. If replacing the original System.ini file with the System.cb file corrects the issue, the problem most likely resides with either the [boot] or [386Enh] sections of the original System.ini file. Restore the original file to troubleshoot it.</li> <li>To isolate the cause of the problem, place a semicolon at the beginning of a line to prevent the item from loading.</li></ol>

For additional information about the System.ini file and its default entries, click the article number below to view the article in the Microsoft Knowledge Base:

140441 Creating a New System.ini File Without Third-Party Drivers

Protected-Mode Device Drivers

Safe mode disables all protected-mode device drivers for Windows 95. You can conduct testing for incompatible components and resource conflicts by disabling the protected-mode device drivers in Device Manager.

Removing Protected-Mode Device Drivers to Isolate Conflicts <ol> <li>

</li> <li>Click Start, point to Settings, click Control Panel, and then double-click System.</li> <li>On the Device Manager tab, click View Devices By Type.</li> <li>Disable each of the protected-mode device drivers. For example: <ol style="list-style-type: lower-alpha;"> <li>Double-click the Floppy Disk Controllers branch to expand it.</li> <li>Click Standard Floppy Disk Controller, and then click Properties.</li> <li>On the General tab, click to clear the Original Configuration (Current) check box, and then click OK.

NOTE: If you have enabled hardware profiles, there is a check box for each of the configurations. Clear the check box for the hardware profile you are troubleshooting.</li> <li>Repeat steps A through C for each device in Device Manager.</li></ol> </li> <li>Click Close, and then restart the computer.</li></ol>

If you resolve the issue by disabling the protected-mode drivers in Device Manager, you may have a hardware conflict or a driver may be incompatible with your hardware. For additional information about troubleshooting resource conflicts in Windows 95, click the article number below to view the article in the Microsoft Knowledge Base:

133240 Troubleshooting Device Conflicts with Device Manager

If you determine that a Windows 95 protected-mode device driver is incompatible with your hardware, contact the hardware manufacturer to determine the availability of new drivers.

Changing the Video Driver to a Standard VGA Driver

NOTE: If you followed the directions in the &quot;Removing Protected-Mode Drivers to Isolate Conflicts&quot; section of this article, you changed the video driver to VGA and you can skip to the next section. Disabling the video adapter sets your video to the VGA driver.

Safe mode starts Windows 95 with the VGA video driver. To determine if the issue you are experiencing is related to your video driver, change to the VGA driver for testing purposes.

NOTE: To ensure a safe return to your previous configuration, use the following steps: <ol> <li>

</li> <li>Back up the System.ini file.</li> <li>Note the current desktop area (resolution) and color palette.</li> <li>Record the name of your current video adapter.</li></ol>

To change to the VGA video driver, follow these steps: <ol> <li>

</li> <li>Start Windows 95 in Safe mode.</li> <li>Click Start, point to Settings, click Control Panel, and then double-click Display.</li> <li>On the Settings tab, click Change Display Type.</li> <li>In the Adapter Type area, click Change.</li> <li>Click Show All Devices.</li> <li>In the Manufacturers box, click (Standard Display Types). In the Models box, click Standard Display Adapter (VGA), and then click OK.</li> <li>Click OK or Close until you return to Control Panel.</li> <li>Restart your computer.</li></ol>

If you determine that your video driver is incompatible with Windows 95, contact the hardware manufacturer to determine the availability of new drivers.

Registry Damage

When you start Windows 95 in Safe mode the registry is read minimally. Damage to the registry may not be evident when running in Safe mode; you may need to replace the existing registry (System.dat) with a backup to determine if the issue is caused by a damaged registry. To troubleshoot a damaged registry, use the following steps: <ol> <li>

</li> <li>Boot to a command prompt.</li> <li>Remove the file attributes from the backup of the registry by typing the following command:

c:\windows\command\attrib -h -s -r c:\system.1st

</li> <li>Remove the file attributes from the current registry by typing the following command:

c:\windows\command\attrib -h -s -r c:\windows\system.dat

</li> <li>Rename the registry by typing the following command:

ren c:\windows\system.dat *.dax

</li> <li>Copy the backup file to the current registry by typing the following command:

copy c:\system.1st c:\windows\system.dat

</li> <li>Restart your computer.</li></ol>

NOTE: The System.1st file is a backup of the registry that is created during the final stage of Windows 95 Setup. Therefore, the &quot;Running Windows 95 for the first time&quot; banner is displayed and Windows 95 finalizes settings as if it is being installed.

If replacing the System.dat file with the System.1st file resolves the issue, the problem may be related to registry damage. Programs and device drivers added after you installed Windows 95 may require reinstallation to update the new registry.

If the issue is not resolved, restore the original registry by using the following steps: <ol> <li>

</li> <li>Restart the computer to a command prompt.</li> <li>Type the following commands, pressing ENTER after each command:

c:\windows\command\attrib -s -h -r c:\windows\system.dat

copy c:\windows\system.dax c:\windows\system.dat

NOTE: Overwrite the existing System.dat file if you are prompted to do so.

</li> <li>Restart the computer.</li></ol>

The Windows 95 CD-ROM includes tools for backing up your system files as well as the registry. For additional information about these tools, click the article numbers below to view the articles in the Microsoft Knowledge Base:

139437 Windows 95 Emergency Recovery Utility

135120 Configuration Backup Tool for Backing Up the Registry

</li></ol>

Test Hardware
To test your hardware, the most efficient method is to install Windows in a new, or clean, folder. If the issue occurs after you have a &quot;clean&quot; installation, your issue is faulty hardware. Contact your hardware manufacturer or have your hardware checked by a hardware specialist. To install Windows in a new folder, use the steps in one of the following Microsoft Knowledge Base articles:

193902 How to Install Windows 98 in a New Folder

142096 How to Install Windows 95 in a New Folder

If your issue is resolved when you install Windows in a &quot;clean&quot; folder, either your Windows core files are damaged, or there is a setting in your original installation that is causing the problem. You can choose to use the new installation of Windows, but you must reinstall your programs. If you want to return to your original installation of Windows and continue troubleshooting, use the steps in the following Microsoft Knowledge Base articles:

193902 How to Install Windows 98 in a New Folder

142096 How to Install Windows 95 in a New Folder

192926 How to Perform Clean-Boot Troubleshooting for Windows 98

243039 How to Perform a Clean Boot in Windows 95

Additional query words: 3.10 gpfault 3.0a

Keywords: kbgpf kbinfo KB82710

-

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

© Microsoft Corporation. All rights reserved.