Causes of General Protection Faults and Troubleshooting Tips

Article translations Article translations
Article ID: 82710 - View products that this article applies to.
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
Expand all | Collapse all

On This Page

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.

MORE INFORMATION

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.
  1. For Windows 95, restart your computer, press F8 when you see the "Starting Windows 95" 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.
  2. 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 "Test Hardware" 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:

    1. Click Start, point to Programs, point to Accessories, point to System Tools, and then click System Information.
    2. On the Tools menu, click System Configuration Utility.
    3. On the General tab, click Selective Startup, and then click to clear the following check boxes:
      • Process Config.sys File
      • Process Autoexec.bat File
      • Process Winstart.bat File (if available)
      • Process System.ini File
      • Process Win.ini File
      • Load Startup Group Items
    4. 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.
    5. 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.
    6. 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.
    7. 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.
    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.

    1. Restart your computer. When the "Starting Windows 95" message is displayed, press F8, and then click Step-By-Step Confirmation from the Startup menu.
    2. When you are prompted, load the following items (if you are prompted to load any other items, press N):
      • Dblspace driver.
      • Himem.sys.
      • Ifshlp.sys.
      • Dblbuff.sys.
      • Load the Windows 95 graphical user interface (GUI), choosing to load all Windows drivers.
      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.

    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 "load=" and "run=" 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:

    1. Boot to a command prompt.
    2. Rename the Win.ini file by typing the following command:
      ren c:\windows\win.ini *.bak
    3. Start Windows 95 by typing win. If this procedure corrects the problem, ensure that the "load=" and "run=" lines in the [Windows] section of the Win.ini file are either blank or preceded with a semicolon (;) to prevent the items from loading.
    4. Rename the System.ini file by typing the following command:
      ren c:\windows\system.ini *.bak
    5. 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
    6. 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.
    7. To isolate the cause of the problem, place a semicolon (;) at the beginning of a line to prevent the item from loading.
    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

    1. Click Start, point to Settings, click Control Panel, and then double-click System.
    2. On the Device Manager tab, click View Devices By Type.
    3. Disable each of the protected-mode device drivers. For example:
      1. Double-click the Floppy Disk Controllers branch to expand it.
      2. Click Standard Floppy Disk Controller, and then click Properties.
      3. 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.
      4. Repeat steps A through C for each device in Device Manager.
    4. Click Close, and then restart the computer.
    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 "Removing Protected-Mode Drivers to Isolate Conflicts" 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:

    1. Back up the System.ini file.
    2. Note the current desktop area (resolution) and color palette.
    3. Record the name of your current video adapter.
    To change to the VGA video driver, follow these steps:

    1. Start Windows 95 in Safe mode.
    2. Click Start, point to Settings, click Control Panel, and then double-click Display.
    3. On the Settings tab, click Change Display Type.
    4. In the Adapter Type area, click Change.
    5. Click Show All Devices.
    6. In the Manufacturers box, click (Standard Display Types). In the Models box, click Standard Display Adapter (VGA), and then click OK.
    7. Click OK or Close until you return to Control Panel.
    8. Restart your computer.
    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:

    1. Boot to a command prompt.
    2. 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
    3. Remove the file attributes from the current registry by typing the following command:
      c:\windows\command\attrib -h -s -r c:\windows\system.dat
    4. Rename the registry by typing the following command:
      ren c:\windows\system.dat *.dax
    5. Copy the backup file to the current registry by typing the following command:
      copy c:\system.1st c:\windows\system.dat
    6. Restart your computer.
    NOTE: The System.1st file is a backup of the registry that is created during the final stage of Windows 95 Setup. Therefore, the "Running Windows 95 for the first time" 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:

    1. Restart the computer to a command prompt.
    2. 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.

    3. Restart the computer.
    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

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 "clean" 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 "clean" 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

Properties

Article ID: 82710 - Last Review: January 18, 2007 - Revision: 1.2
APPLIES TO
  • Microsoft Windows 95
  • Microsoft Windows 98 Standard Edition
Keywords: 
kbgpf kbinfo KB82710

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com