Iniciando el sistema. NT starts

System initialization occurs in eight phases:
 
  1. Firmware
  2. OS Loader

  3. This phase sets up memory, captures hardware configuration data, constructs a description of the machine hardware in memory, and puts a pointer to this description into the loader block. NTLDR or OSLOADER then loads and relocates the kernel image, the HAL, and the driver(s) for the device and file system for the volume from which the system is booted. Any other device drivers that have a Start value of 0 are loaded at this time.
  4. Kernel Startup

  5. This phase calls a routine to fetch load-control information from the registry, such as the default or user-set size of resident system-space memory (nonpaged pool) and of the registry quota.
     
  6. CmInitSystem

  7. The Configuration Manager initializes two subtrees under the \Registry\Machine tree in the registry, enables the registry API, and creates the CurrentControlSet symbolic link in preparation for loading device drivers. At the end of this phase, the registry namespaces under \Registry\Machine\Hardware and \Registry\Machine\System can be both read and written.
     
  8. IoInitSystem

  9. This phase initializes and loads the rest of the Windows NT Executive, including certain kernel-mode drivers, according to the CurrentControlSet. First, the drivers loaded into memory in Phase 2 are initialized from the boot driver list. Next, other base drivers are loaded and initialized. At the end of this phase, the system’s core drivers are all active, unless a critical driver fails its initialization and the machine is rebooted.
     
  10. MmFreeLoaderBlock

  11. This phase releases the loader block, some of configuration data that was collected in Phase 2, and the initial copy of the \Registry\Machine\System hive. However, the \Registry\Machine\Hardware configuration information is retained.
     
  12. Session Manager

  13. This phase runs certain programs (such as autocheck), calls the Windows NT Executive to open paging files so files can be written, and initializes the remainder of the registry. Before this phase, certain registry I/O requests have been cached, such as information core drivers might have written to the registry for use by still higher-level drivers that load later. At the end of this phase, all configuration information under \Registry\Machine is available.
     
  14. Service Controller

  15. This phase loads remaining drivers according to the CurrentControlSet and creates the LastKnownGood tree in the registry.

Machine Initialization: Phase 2

On x86 platforms, the machine hardware is initialized at boot time by the NTLDR. To initialize the video hardware, NTLDR makes a BIOS call to set the video adapter in 80x50, 16-color, alphanumeric mode. It then clears the screen and displays the Boot Manager messages.

On RISC platforms, the entire machine, including video hardware, is initialized by the OSLOADER, which programs an appropriate alphanumeric mode to display the Boot Manager information.



HAL Control of Video: Phases 3 to 5

After the operating system and boot drivers are loaded from the disk into memory by NTLDR or OSLOADER, control is passed to the Windows NT Executive.

The HAL is an Executive component that exports the platform-specific functionality. It supports limited output functionality to allow the Kernel to display informational and error messages as other components of the kernel-mode Executive are initialized.

The NTLDR’s initial BIOS call is made in x86 real mode.

HAL support for video output also is necessary if the machine crashes. The HAL can be called by the Kernel to reinitialize the video adapter to an alphanumeric mode and to display information, such as a register dump and stack backtrace.


Kernel Driver Initialization: Phase 5

The Registry’s System hive, which is visible to users under the HKEY_LOCAL_MACHINE tree after the system is running, determines the load order of all drivers in the system. The NTLDR or OSLOADER and the I/O Manager both access the contents of the System hive to determine which drivers should be loaded and when each driver should be initialized.

Each driver key under the registry node HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services has a value entry named Start. The value assigned to Start determines when any particular driver is loaded during the system initialization process.

When each driver is loaded, its DriverEntry routine is automatically called by the I/O Manager.

For each device object created, a driver may create a corresponding value entry with a name that is the same as the device object in the registry under HKEY_LOCAL_MACHINE\Hardware\DeviceMap.

Both the created value entry in the registry DeviceMap and the symbolic link are volatile: each is regenerated automatically every time the machine is booted, based on the drivers that were initialized by the I/O Manager. Both are logical names representing a device in the machine.


Service Controller Initialization: Phase 8

In this phase of initialization the Service Control Manager will proceed to load any remaining drivers that have a Start value of 2. These drivers will be displayed in the control panel applet as being started automatically. These drivers are loaded in order by load order group, if specified, and then all remaining drivers will be loaded alphabetically.


Controlling Driver Load Order

The first driver to claim a device obtains ownership of that device, either shared or exclusive.

Driver load order is determined by entries in the \Machine\System\CurrentControlSet key in the registry. This key has a Control subkey containing system-wide information and a Services subkey containing driver-specific information.

During system initialization, when a driver is loaded depends on the following characteristics:

Driver Start Value
A driver can have one of the following values in \Machine\System\CurrentControlSet\Services\DriverName\Start: Driver Load Service Group
Drivers with start values of SERVICE_BOOT_START and SERVICE_SYSTEM_START can be organized into groups to further structure the order in which they are loaded.

\Machine\System\CurrentControlSet\Control\ServiceGroupOrder contains a list of the driver load service groups. The list is scanned twice. First, all drivers with start value SERVICE_BOOT_START are loaded; then all drivers with start value SERVICE_SYSTEM_START are loaded.

If a driver is a member of a load service group, the group name is listed in the driver’s services subkey in the registry (\Machine\Hardware\System\CurrentControlSet\Services\DriverName\Group).

After all ServiceGroupOrder groups of a given Start value have been loaded, the system loads all groups not in the list and then all drivers without a group.

Load Order Within a Group
Drivers that are in a load group and have a start value of SERVICE_BOOT_START or SERVICE_SYSTEM_START can use tags to indicate their load order within the group.

The registry key \Machine\Hardware\System\CurrentControlSet\Control\GroupOrderList defines the number of tags in each group and the order in which tagged drivers are loaded within a group.

Drivers without a tag are loaded last in their group.

Not every group is included in the GroupOrderList. When a group is not in the GroupOrderList, the order in which the drivers load within the group cannot be guaranteed.

Dependencies
Prerequisite drivers are listed in a driver’s services subkey in the DependOnGroup and DependOnService entries.

Defining Driver Load Order for New Drivers
To define the load order for a new driver, assign the driver a start value, a service group (optional), a group tag (optional), and prerequisite drivers (optional).

The start value must be one of the system-defined SERVICE_xxx values.

The service group can be an existing system-defined group or a new group. If you define a new group, add it to \Machine\System\CurrentControlSet\Control\ServiceGroupOrder. Note that ServiceGroupOrder is reset during a system upgrade, so drivers that modify this registry key may need to be reinstalled after an upgrade.

Use an existing group tag, or define a new one in \Machine\System\CurrentControlSet\Control\GroupOrderList.

List prerequisite drivers in DependOnGroup and DependOnService in the driver’s services key.

A driver writer can modify the registry using routines, INF files, or the Windows NT registry editor (regedt32). During driver development it may be convenient to edit the registry manually with the registry editor. When the driver is nearing completion, it is best for the driver to make any necessary registry changes using routines (RtlCreateRegistryKey and RtlWriteRegistryValue) or through the driver’s INF file.



Starting with the Last Known Good Configuration

    At starting when you see the prompt 'Press spacebar NOW to invoke Hardware Profile/Last Known Good',  press Spacebar and you will see the Hardware Profile/Configuration Recovery Menu. If you press L, you will switch to the Last Known Good configuration. You can switch back to the default by pressing D. Hit Enter, and NT should load.



Referencias