Windows fails to start with error Missing or Corrupt ntoskrnl.exe when keys are pressed during startup

Symptoms

When you press or hold down keys on the keyboard as you start your computer, you may see the following message and Windows will fail to start.

Windows could not start because the following file is missing or corrupt:
<Windows root>\system32\ntoskrnl.exe.
Please re-install a copy of the above file.

This problem does not occur if you do not press any keys during startup.

Note This problem can occur on any Windows operating system prior to Windows 7, on both 32-bit and 64-bit platforms.

Cause

This problem occurs because, during a very small time frame, key presses may cause a part of Windows initialization to fail.

This problem does not cause any corruption or data loss, and the ntoskrnl.exe file is not corrupt as the error message says.

Resolution

To workaround this issue, do not press any keys during startup until the Windows startup screen is displayed.

Microsoft Internal Support Information

Steps to reproduce. Hold the shift key while starting the OS.

Product Bug Number: Windows7 25496; Windows OS Bugs 1991512
Author ID (email alias):takondo
Writer ID(email alias):takondo
Tech Review ID (email alias):
Confirm Article has been Tech Reviewed: Yes/No
Confirm Article released for Publishing: Yes/No

 

This problem occurs because we don't disable keyboard interrupts before trying to enable A20. Because we're enabling A20 through the keyboard controller, hitting keys or holding keys down during startup may cause a keyboard interrupt to occur while we're trying to enable A20. This causes us to fail enabling the A20, leaving bit 20 of the address masked.

When this occurs, we ultimately fail to load ntoskrnl.exe because we actually overwrite the in-memory image. Say we start loading ntoskrnl.exe from 0x80610000 to 0x807f8000. Because bit 20 is masked, 0x80710000 and 0x80610000 point to the same memory location, which causes us to start overwriting the beginning of the image. Thus, when we check the image after we finish loading, we find that the image is corrupt.

Only the image on-memory is corrupt, simply because we corrupted it ourselves. The on-disk image should have no problems.

Properties

Article ID: 2022960 - Last Review: Oct 27, 2010 - Revision: 1

Feedback