Understanding the Boot Procedure of Windows 7: A Comprehensive Guide

Understanding the Boot Procedure of Windows 7: A Comprehensive Guide

When you turn on your computer with Windows 7 as the operating system, the booting process is intricate but fundamentally important for your system to start up smoothly. This guide will help you understand the boot procedures, both in Legacy and UEFI modes, to provide you with a complete understanding of how your Windows 7 system boots up.

Introduction to the Boot Procedure

When you turn on your computer, it goes through a process known as the boot procedure. The primary device to be listed in the boot sequence is the device where Windows is installed. Common devices include the CD or DVD drive, the hard drive, USB flash drive, and Solid State Drives (SSDs). This booting process is similar for both Windows Vista and Windows 10, with variations starting from Windows 7 due to the introduction of UEFI.

Legacy Boot Mode

The Bios and the Master Boot Record (MBR)

In Legacy boot mode, the BIOS is responsible for the initial loading process. When the system boots, the BIOS first checks the disk where Windows is installed. It reads the Master Boot Record (MBR), which is the first sector of the disk. The MBR contains a specific pattern in the last two bytes that marks the MBR as bootable. If the pattern matches, the BIOS then loads the following sector of code into memory at a fixed address and runs the code starting from the first byte of the loaded sector.

Partition Boot Record (PBR)

After the MBR, the BIOS loads the Partition Boot Record (PBR), which is the first sector of the active partition. The PBR can utilize up to 510 bytes for code, although some systems may use it to store a file system signature. The PBR attempts to load an uncompressed file named "bootmgr" from the disk. Once "bootmgr" is loaded, it performs its own boot process.

UEFI Boot Mode

UEFI (Unified Extensible Firmware Interface) introduces a more advanced and flexible boot process. UEFI firmware can check boot entries memorized in the hardware and attempt each one. If none of the boot entries are valid or are no longer found, UEFI searches each disk, typically starting with the EFI System Partition, for a file named "efibootbootx64.efi." Once the correct .efi file is found and loaded, it runs as the primary boot loader.

After Loading Bootmgr

Boot Configuration and Boot Manager

After loading bootmgr, the boot manager checks the system's configurations stored in the registry hives. These hives are similar to the actual Windows registry hives and are mounted into the Windows registry after boot. The boot manager identifies the Windows system that needs to be booted or loaded from hibernation. If hibernation is involved, it looks for the appropriate "winload.exe" and loads it. If the boot manager needs to boot a Windows system directly, it searches for the "ntoskrnl.exe" kernel. After the kernel loads, it places the boot manager in its near-final memory location and passes control to the kernel.

Kernel and Driver Loading

The kernel then loads additional drivers, mounts the system registry hives, and initializes devices using the code contained in the drivers. The boot manager then launches the smss.exe process, which spawns the csrss.exe processes for all sessions, the wininit.exe process for session 0, and the winlogon.exe process for the other sessions. In session 0, winlogon.exe starts the services.exe process, which launches all the Windows services. Another critical process, lsass.exe, implements security-related critical actions.

User Environment Initialization

winlogon.exe may then launch logonui.exe, which shows the lock/login screen. userinit.exe launches the user shell, typically explorer.exe, which displays the desktop icons and the taskbar. Additionally, dwm.exe, the Aero compositor, is launched, which is mandatory in Windows 8 and later versions.

User Configuration and Additional Services

The system then proceeds to launch other processes and services based on user configurations and installed software. These processes can vary widely depending on the user's configuration.

Understanding the boot procedure helps in troubleshooting issues and ensures a smooth operation of your system. Whether you are dealing with Legacy or UEFI boot modes, knowing each step of the process is crucial for a better understanding of your system's behavior during startup.