Subscribe to Windows IT Pro
January 01, 1999 12:00 AM

Inside the Boot Process, Part 2

Windows IT Pro
InstantDoc ID #4711
Rating: (1)

Shortly after win32k.sys starts, it switches the screen to graphics mode. A little later, Winlogon starts the Services subsystem (\winnt\system32\services.exe), which loads all services and device drivers marked Auto Start. (The Services subsystem is also known as the Service Control Manager--­SCM.) Auto Start drivers and services can specify a dependency on a specific service by including a DependOnService value in their Registry keys in a manner similar to the way boot drivers use the DependOnGroup value. The SCM sorts and then initializes the Auto Start drivers and services according to their group and tag values in the same way the I/O Manager sorts the boot- and system-start drivers.

After the SCM initializes the Auto Start services and drivers, it deems the boot successful. The Registry subkey HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet becomes the Last Known Good control set, because the system booted successfully to this point. Earlier in the boot, NT made a copy of this subkey and named the copy HKEY_LOCAL_MACHINE\SYSTEM\CLONE. Any changes drivers make to the current control set during the boot do not change the CLONE subkey copy. The SCM copies the CLONE subkey to another control set subkey (e.g., HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001), and the SCM marks that control set subkey as Last Known Good. The SCM marks the subkey by setting the HKEY_LOCAL_MACHINE\SYSTEM\Select\LastKnownGood value to specify the three-digit identifier at the end of the control set's subkey name (e.g., 001). If a user chooses to boot to the Last Known Good menu during the first steps of a boot, or if a driver returns a severe or critical error, the system uses the Last Known Good profile subkey as HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet. Doing so increases the chances that the system will boot successfully, because at least one previous boot using the Last Known Good profile was successful.

At approximately the time the Services subsystem is starting networking services, Winlogon presents users with the initial logon dialog box. That action brings us to the end of the boot process.

Shutdown
In contrast to the boot process, system shutdown is straightforward. First, the Win32 subsystem informs all Windows applications that the system is going down. Most applications exit voluntarily, and Winlogon stops any stragglers. Winlogon is in charge of finishing the shutdown process by calling the Executive subsystem function NtShutdownSystem. This function calls the I/O Manager, the Configuration Manager, the Memory Manager, and then the I/O Manager again, and informs them that they should prepare for the shutdown.

The first time NtShutdownSystem calls the I/O Manager, the I/O Manager sends shutdown I/O packets to all device drivers that have requested shutdown notification. This action gives device drivers a chance to perform any special processing their device might require before NT exits. The Configuration Manager flushes any modified Registry data to disk, and the Memory Manager writes all modified pages containing file data back to their respective files. If the option to clear the paging file at shutdown is enabled, the Memory Manager clears the paging file at this time. The second time NtShutdownSystem calls the I/O Manager, the I/O Manager informs the file system drivers that the system is shutting down. Finally, if the system's user specified a reboot after the shutdown, the system calls the HAL to reboot the computer.

We've arrived at shutdown for this month's column. This two-column series about the boot process is a roadmap with visual cues to the operations that take place behind the scenes when your system boots. Table 3 presents a summary of boot-process components with their execution modes and responsibilities. Understanding the details of the boot process helps you to diagnose problems that can arise during a boot, and gives you insight into the way NT pulls itself up by its bootstraps.

Related Content:

ARTICLE TOOLS

Comments
  • Anonymous User
    7 years ago
    Jan 11, 2005

    This article is extremely useful and I'd like to give my utmost gratitude to the writer who writes such a wonderful and informative article. I'm not that expert to understand certain difficult parts of this article, but here's a simple question: Since SMSS loads the win32 subsystem only after the BootExecute programs, this means the programs loaded through BootExecute are not able to use the win32 functions, right? In order to create programs that run before the win32 subsystem loads, such programs must avoid the usage of win32 functions, and thus programs of VB6 are not executable in that phase, right? If it's true, then how should I create my programs? I am thinking of MS-DOS programs. Please correct me as I'm not an expert in this area.

  • ts taylor
    8 years ago
    Apr 28, 2004

    i would like to thank you for this article. although this is the most informative piece i have been able to find on the steps the computer takes to boot, i also need to know what happens once a user clicks on their picture on the welcome screen & logon begins...ending with the desktop/taskbars loaded. i have been trying to figure out what is going on with my "boot/logon" processes in my XP home OS to pinpoint whatever is not loading preventing my desktop, taskbars, & start menu along with many other things on my system from functioning like user accounts, system info, help, device manager, etc. if there is a subsequent article to this explaining logon steps, i would appreciate it if you would contact me by email and let me. thank you again for this wonderful article. tst

  • Nguyen Manh Thang
    9 years ago
    Nov 06, 2003

    Please send me some information about boot process when loading,initialization ,installation driver in WIN NT

  • Shailendra Shenoy
    13 years ago
    Aug 06, 1999

    In Mark Russinovich’s NT Internals: “Inside the Boot Process, Part 2” (January 1999), the author states that the Service Control Manager (SCM) deems a Windows NT boot successful after the SCM successfully initializes Auto Start services and drivers. He goes on to say that after NT creates the LastKnownGood control set, the Winlogon process presents the logon dialog box, which ends the boot process.
    However, the Microsoft Windows NT Server 4.0 Resource Kit says that an NT boot is complete only after a user successfully logs on to the system. NT copies the Clone control set (in HKEY_LOCAL_
    MACHINE\\SYSTEM) to the LastKnownGood control set. This step is important because if an NT boot fails and the user has not yet logged on, NT can successfully invoke the Last Known Good configuration the next time the system starts. But if the system crashes just after the user logs on, the Last Known Good menu might not help.
    In the author’s description of the NT shutdown process, he does not discuss stopping the SCM services (the part of the process that takes up most of the time during shutdown). Do the Memory Manager and Configuration Manager flush data to disk before or after the services shut down?

    --Shailendra Shenoy



    I was unclear in the article about when NT copies the Clone control set. The resource kit documentation is correct: NT copies the key only after all services have successfully started and a successful logon takes place. To answer your question, services shut down before the final cleanup by kernel-mode components.

    --Mark Russinovich

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.