Jump to content

NTLDR

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 132.38.190.10 (talk) at 18:05, 19 August 2009 (Undid revision 308823255 by 125.63.74.101 (talk) Undo of unusual deletion in middle of paragraph). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

NTLDR (abbreviation of NT Loader) is the boot loader for all releases of Microsoft's Windows NT operating system up to and including Windows XP and Windows Server 2003. NTLDR is typically run from the primary hard disk drive, but it can also run from portable storage devices such as a CD-ROM, USB flash drive, or floppy disk. NTLDR can also load a non NT-based operating system given the appropriate boot sector in a file.

NTLDR requires, at the minimum, the following two files to be on the system volume:

  • NTLDR, which contains the main Boot loader itself
  • boot.ini, which contains configuration options for a boot menu.

To load an NT-based OS, ntdetect.com must also be present. (Strictly speaking, only NTLDR is actually required. If boot.ini is missing, NTLDR will default to \Windows on the first partition of the first hard drive. Many desktops in the home are in this configuration and a missing boot.ini file will simply generate an error stating it is missing, then boot into Windows successfully.) In Vista, Boot information is stored in a Registry-like file called the Boot Configuration Data (BCD) store. Extensive information on the new boot process can be found at this Microsoft site. Vista comes with a command-line tool bcdedit.com for configuring BCD. However, the command-line tool is rather complicated to use and a free editor called EasyBCD has a graphical user interface that is simpler to use.

The Volume Boot Record written to disk by the Windows NT format command attempts to load and to run the NTLDR program.

In Windows Vista and Windows Server 2008, NTLDR was replaced; the boot loader functionality is instead provided by two new components: winload.exe and the Windows Boot Manager.

Startup process

When booting, the loader proper portion of NTLDR does the following in order:

  1. Accesses the file system on the boot drive (either FAT or NT File System, NTFS).
  2. If hiberfil.sys is found, and it finds a hibernation image, its contents are loaded into memory and the system resumes where it left off.
  3. Otherwise, reads boot.ini and prompts the user with the boot menu accordingly.
  4. If a non NT-based OS is selected, then NTLDR loads the associated file listed in boot.ini (bootsect.dos if no file is specified or if the user is booting into a DOS based OS) and gives it control.
  5. If an NT-based OS is selected, then NTLDR runs ntdetect.com, which gathers information about the computer's hardware. (If ntdetect hangs during hardware detection there is a debug version called ntdetect.chk which can be found on Microsoft support.[1])
  6. Starts Ntoskrnl.exe, passing to it the information returned by ntdetect.com. [2]

boot.ini

NTLDR allows the user to choose which operating system to boot from at the menu; for NT and NT-based operating systems, it also allows the user to pass preconfigured options to the kernel. The menu options are stored in boot.ini, which itself is located in the root of the same disk as NTLDR.

For NT-based OSs, the location of the operating system is written as an Advanced RISC Computing (ARC) path.

boot.ini is protected from user configuration by having the following file attributes: system, hidden, read-only. To make it editable, you must first unlock it with the following command under a console attrib -s -h -r boot.ini. A more secure fashion to edit the file is to use the bootcfg command from a console. bootcfg will also relock the file (setting the file back to system, hidden and read-only). Additionally, the file can be edited within Windows using a text editor if the folder view option "Show hidden files and folders" is selected and the folder view option "Hide protected operating system files" is unchecked and the "Read-only" option is unchecked under file properties.

bootsect.dos is the boot sector loaded by NTLDR to load DOS. If there is no file specified, NTLDR loads bootsect.dos

Example

An example of a boot.Ini file:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

If the boot loader timeout option in boot.ini is set to 0, the NTLDR boot menu does not appear. Extreme caution should be taken when modifying the boot loader, as erroneous information can result in an OS that fails to boot.

NT Kernel switches

File:NTLDR Menu.png
NTLDR Bootloader's Advanced Option Menu
  • /3gb — Forces x86-based systems to allocate 3 GB of virtual address space to programs and 1 GB to the kernel and to executive components. Used for some programs that require more than the standard 2 GB allocation for user programs. Some configurations of Microsoft Exchange Server 2003 and Windows Server 2003 may require this switch. [3]
  • /basevideo — Forces the system into standard 640x480 16-color VGA mode. Use this switch in conjunction with the /sos switch. [3]
  • /baudrate=nnn — Sets the baud rate of the debug port that is used for kernel debugging. If this switch is in the Boot.ini file, the /debug switch is automatically enabled. [3]
  • /bootlog — Turns on boot logging to a file named %SystemRoot%\Ntbtlog.txt. [3]
  • /bootlogo — Displays an alternate 640x480 16-color custom bitmap. The bitmap must be saved in the \Windows directory with the name "Boot.bmp". Use with the /noguiboot switch. [4]
  • /burnmemory=nnn — Specifies the amount of memory, in megabytes, that Windows cannot use. Use this parameter to confirm a performance problem or other problems that are related to RAM depletion.[3]
  • /channel — Use with the /debug switch and the /debugport switch to configure Windows to send debug information over an IEEE 1394 (FireWire) port. [3]
  • /crashdebug — Loads the kernel debugger at OS startup, but it remains inactive until a Stop Error occurs. With this switch, the COM port can be used for normal operations while Windows is running. If Windows crashes, the switch converts the port to a debug port. (This action turns on remote debugging.) [3]
  • /debug — Turns on the kernel debugger when Windows starts. Unlike the /crashdebug switch, /debug uses the COM port whether you use debugging or not. [3]
  • /debugport=comx — Specifies the COM port to use for the debug port. By default, /debugport uses COM2 if it exists. Otherwise, the switch uses COM1. If this switch is in the Boot.ini file, the /debug switch becomes active. [3]
  • /fastdetect — Turns off serial mouse detection. [3]
  • /fastdetect:comx — Turns off serial and bus mouse detection for the specified port. Use this switch when there is a component other than a mouse attached to a serial port during the startup process. Ports may be separated with commas to turn off more than one port. (Note: In earlier versions of Windows, including Windows NT 4.0, this switch was named /noserialmice.) [3]
  • /HAL=filename — Defines the Hardware Abstraction Layer that is loaded at startup. This switch is useful to try out a different HAL before you rename the file to Hal.dll. This switch is also useful when you want to try to switch between starting in multiprocessor mode and starting in single processor mode. To do this, use this switch with the /kernel switch. [3]
  • /kernel=filename — Defines the kernel that is loaded at startup. With this switch, you can switch between a debug-enabled kernel that is full of debugging code and a regular kernel. [3]
  • /maxmem=nnn — Specifies the max amount of RAM, in megabytes, that Windows can use. [3] However, the /maxmem switch does not account for memory holes. Therefore, it is recommended to use the /burnmemory switch instead. [5]
  • /minint — This option is used by Windows Preinstallation Environment (WinPE) and loads the Registry SYSTEM hive as a volatile hive such that changes made to it in memory are not saved back to the hive image. [4]
  • /nodebug — Turns off debugging. This scenario can cause a Stop Error if a program has a debug hardcoded breakpoint in its software. [3]
  • /noexecute=optin/optout/alwayson/alwaysoff — This option is only available on 32-bit versions of Windows when running on processors supporting Data Execution Prevention. It enables DEP, which results in the memory manager marking pages containing data as no-execute so that they cannot be executed as code. This can be useful for preventing malicious code from exploiting buffer overflow bugs with unexpected program input in order to execute arbitrary code. No-execute protection is always enabled on 64-bit versions of Windows on processors that support no-execute protection. There are several options you can specify with this switch: [4]
    • /NOEXECUTE=OPTIN — Enables DEP for core system images and those specified in the DEP configuration dialog.
    • /NOEXECUTE=OPTOUT — Enables DEP for all images except those specified in the DEP configuration dialog.
    • /NOEXECUTE=ALWAYSON — Enables DEP on all images.
    • /NOEXECUTE=ALWAYSOFF — Disables DEP.
  • /noguiboot — Disables the bitmap that displays the progress bar for Windows startup. [3] This also disables the text output by chkdsk.[citation needed]
  • /nopae — Forces Ntldr to load the non-Physical Address Extension (PAE) version of the Windows kernel, even if the system is detected as supporting x86 PAEs and has more than 4 GB of physical memory. [4]
  • /noserialmice=comx — (Obsolete on all versions post-Windows NT 4.0) Replaced by the absence of the /FASTDETECT switch. Disables serial mouse detection on the specified COM ports. Using /NOSERIALMICE without specifying a COM port disables serial mouse detection on all COM ports. [4]
  • /numproc=nnn — Sets the number of processors that Windows will run at startup. With this switch, you can force a multiprocessor system to use only the quantity of processors (number) that you specify. Useful for troubleshooting performance problems and defective CPUs. [3]
  • /onecpu — Equivalent to using /numproc=1. Causes Windows to use only one CPU on a multiprocessor system. [4]
  • /pae — Enables Physical Address Extension support. In Safe Mode, the computer starts by using normal kernels, even if the /PAE switch is specified. [3]
  • /pcilock — For x86-based systems, this stops the operating system from dynamically assigning hardware input, hardware output, and interrupt request resources to PCI devices. Instead, the BIOS configures the devices. [3]
  • /redirect — Turns on Emergency Management Services (EMS) on a Windows Server 2003, Enterprise Edition-based computer. To turn on EMS by editing the Boot.ini on an x86-based computer, edit both the [boot loader] section and the [operating systems] section of the Boot.ini file. [3]
  • /safeboot — Causes Windows to start in Safe Mode. You can combine other Boot.ini parameters with /safeboot:parameter. The following examples illustrate the parameters that are in effect when you select a Safe Mode option from the startup recovery menu. (Note: The /sos, /bootlog, and /noguiboot switches are not required with any one of these settings, but the switches can help with troubleshooting.) [3]
    • Safe Mode (/safeboot:minimal /sos /bootlog /noguiboot) — Default: Uses a minimal set of device drivers and services to start Windows. [6]
    • Safe Mode with Networking (/safeboot:network /sos /bootlog /noguiboot) — Default mode together with the drivers necessary to load networking. [6]
    • Safe Mode with Command Prompt (/safeboot:minimal(alternateshell) /sos /bootlog /noguiboot) — Default mode, except that Cmd.exe starts instead of Windows Explorer. [6]
    • Windows in Directory Services Restore Mode (/safeboot:dsrepair /sos) — (This mode is valid only for Windows-based domain controllers.) Performs a directory service repair. [6]
  • /sos — Displays the device driver names while they are being loaded. Use with the /basevideo switch to determine the driver that is triggering a failure. [3]
  • /usepmtimer — Specifies that Windows uses the Power Management Timer (PM_TIMER) timer settings instead of the Time Stamp Counter (TSC) timer settings if the processor supports the PM_TIMER settings. [3] By default, Windows Server 2003 Service Pack 2 (SP2) uses the PM timer for all multiprocessor APIC or ACPI HALs. If you are not running Windows Server 2003 SP2, you must force the computer to use the PM timer by using the /usepmtimer switch. [7]
  • /userva=nnn — Customizes the amount of memory, in megabytes, that is allocated to processes when using the /3GB switch. This switch permits more page table entry kernel memory but still maintains almost 3 GB of process memory space. [6]
  • /w95 — Directs Ntldr to boot the Windows boot sector stored in Bootsect.w40. [4]
  • /w95dos — Directs Ntldr to boot the MS-DOS boot sector stored in Bootsect.dos. [4]
  • /year — Instructs the Windows core time function to ignore the year that the computer's real-time clock reports and instead use the one indicated. Example: /year=2001. (This switch was created to assist in Y2K testing.) [4]

See also

References

  1. ^ Windows 2000 Server
  2. ^ Microsoft (2000). Windows 2000 Professional Resource Kit (1st ed.). Redmond, WA: Microsoft Press. ISBN 1-57231-808-2.
  3. ^ a b c d e f g h i j k l m n o p q r s t u v w Available switch options for the Windows XP and the Windows Server 2003 Boot.ini files
  4. ^ a b c d e f g h i Boot INI Options Reference
  5. ^ MSDN: /burnmemory specification
  6. ^ a b c d e A description of the Safe Mode Boot options in Windows XP
  7. ^ Programs that use the QueryPerformanceCounter function may perform poorly in Windows Server 2000, in Windows Server 2003, and in Windows XP

External links