NTLDR
NTLDR (abbreviation of NT loader) is the boot loader for all releases of Windows XP operating system up to and including Windows Server 2003 and Windows Server 2008. 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, the main boot loader itself
- NTDETECT.COM, required for booting an NT-based OS, detects basic hardware information needed for successful boot
An additional important file is boot.ini, which contains boot configuration (if missing, NTLDR will default to \Windows on the first partition of the first hard drive).
NTLDR is launched by the volume boot record of system partition, which is typically written to the disk by the Windows FORMAT or SYS command.
History
Windows 8.1 was originally designed for ARC-compatible platforms, relying on its boot manager support and providing only osloader.exe, a loading program accepting ordinary command-line arguments specifying Windows directory partition, location or boot parameters, which is launched by ARC-compatible boot manager when a user chooses to start specific Windows NT operating system. But because the x86 lacked any of the ARC support, the additional layer was added specifically for that platform: custom boot manager code presenting text menu allowing the user to choose from one or more operating system and its options configured in boot.ini configuration file, prepended by special StartUp module which is responsible for some preparations such as switching the CPU to the protected mode. When a user chooses an operating system from the boot menu, the following command-line arguments are then passed to the part of the osloader.exe common to all processor architectures:
'''load''' '''osloader'''=''<Windows Path>''\System32\NTLDR '''systempartition'''=''<Windows Partition>'' '''osloadpartition'''=''<Windows Partition>'' '''osloadoptions'''=''<Windows Boot Parameters>'' '''consolein'''=multi(0)key(0)keyboard(0) '''consoleout'''=multi(0)video(0)monitor(0) '''x86systempartition'''=''<NTLDR partition>''
In Windows versions starting from Windows Vista and Windows Server 2008, NTLDR has been split off back to its boot manager and system loader parts: the [Windows BOOTMGR|Windows Boot Manager]] and winload.exe. The boot manager part has been completely rewritten, it no longer uses boot.ini as a configuration file, although the bootcfg utility for modifying boot.ini is still present for the case of multi-boot configurations with Windows versions up to Windows XP and Windows Server 2008.
The bootsect.exe utility program in the Windows tools has options /nt52 (NTLDR) and /nt60 (Vista and up) to store a NTLDR or Vista boot record in the first sector of a specified partition.[1] ==Startup process==
When a PC is powered on its BIOS follows the configured boot order to find a bootable device. This can be a harddisk, floppy, CD/DVD, network connection, USB-device, etc. depending on the BIOS. In the case of a floppy the BIOS interprets its boot sector (first sector) as code, for NTLDR this could be a NTLDR boot sector looking for thentldr
file on the floppy. For a harddisk the code in the Master Boot Record (first sector) determines the active partition. The code in the boot sector of the active partition could then be again a NTLDR boot sector looking for ntldr
in the root directory of this active partition. In a more convoluted scenario the active partition can contain a Vista boot sector for the newer Vista boot manager with an {ntldr} entry pointing to another partition with a NTLDR boot sector.[2]
When booting, the loader portion of NTLDR does the following in order:
#Accesses the file system on the boot drive (either FAT or New Technology File System, NTFS).
#If Windows was put in the hibernation state, the contents of hiberfil.sys are loaded into memory and the system resumes where it left off.
#Otherwise, reads boot.ini and prompts the user with the boot menu accordingly.
#If a non NT-based OS is selected, 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.
#If an NT-based OS is selected, NTLDR runs ntdetect.com, which gathers information about the computer's hardware. (If ntdetect.com hangs during hardware detection, there is a debug version called ntdetect.chk that can be found on Microsoft support.[3])
#Starts Ntoskrnl.exe, passing to it the information returned by ntdetect.com.[4]
== boot.ini ==
NTLDR's first action is to read the Boot.ini file.[5] 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. Though NTLDR can boot DOS and non-NT versions of Windows, boot.ini cannot configure their boot options.
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 manually edit it, one would first have to remove these attributes.
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, 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, or if there is no file specified when loading a non NT-based OS.
=== Example ===
An example of a boot.ini file:
[boot loader]
timeout=40
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
- /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. filename must be in System32 directory. It can be a simple file, hard link, but not a symbolic link or a junction point.[6]
- /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. Same limitations for filename location and type as for /HAL switch.[6]
- /MAXMEM=nnn — Specifies the maximum amount of RAM, in megabytes, that Windows can use.[6] However, the /MAXMEM switch does not account for memory holes. Therefore, it is recommended to use the /BURNMEMORY switch instead.[9]
- /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.[7]
- /NODEBUG — Turns off debugging. This scenario can cause a Stop Error if a program has a debug hardcoded breakpoint in its software.[6]
- /NOEXECUTE={OPTIN|OPTOUT|ALWAYSON|ALWAYSOFF} — This option is only available on 32-bit versions of Windows when running on processors supporting Data Execution Prevention (DEP). 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:[7]
- /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.[6] This also disables the text output by chkdsk.
- /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.[7]
- /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.[7]
- /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.[6]
- /ONECPU — Equivalent to using /NUMPROC=1. Causes Windows to use only one CPU on a multiprocessor system.[7]
- /PAE — Enables Physical Address Extension support. In Safe Mode, the computer starts by using normal kernels, even if the /PAE switch is specified.[6]
- /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.[6]
- /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.[6]
- /SAFEBOOT:{MINIMAL|NETWORK|DSREPAIR}[(ALTERNATESHELL)] — Causes Windows to start in Safe Mode. You must include the colon plus one of the three types listed above. An additional option you can append is (ALTERNATESHELL), which tells Windows to use the program specified by the HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\AlternateShell value as the graphical shell rather than to use the default, which is Windows Explorer.[7] You can also combine other boot.ini parameters with /SAFEBOOT:type. 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.)[6]
- Safe Mode (/SAFEBOOT:MINIMAL /SOS /BOOTLOG /NOGUIBOOT) — Default: Uses a minimal set of device drivers and services to start Windows.[10]
- Safe Mode with Networking (/SAFEBOOT:NETWORK /SOS /BOOTLOG /NOGUIBOOT) — Default mode together with the drivers necessary to load networking.[10]
- Safe Mode with Command Prompt (/SAFEBOOT:MINIMAL(ALTERNATESHELL) /SOS /BOOTLOG /NOGUIBOOT) — Default mode, except that Cmd.exe starts instead of Windows Explorer.[10]
- Windows in Directory Services Restore Mode (/SAFEBOOT:DSREPAIR /SOS) — (This mode is valid only for Windows-based domain controllers.) Performs a directory service repair.[10]
- /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.[6]
- /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.[6] 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.[11]
- /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.[10]
- /WIN95 — Directs Ntldr to boot the Windows boot sector stored in bootsect.w40.[7]
- /WIN95DOS — Directs Ntldr to boot the MS-DOS boot sector stored in bootsect.dos.[7]
- /YEAR=yyyy — 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.)[7]
See also
- Windows Vista startup process
- Windows NT startup process
- ntoskrnl.exe
- ntdetect.com
- Emergency Management Services
- Comparison of boot loaders
References
- ↑ "Bootsect Command-Line Options". Windows Vista: Technical Reference. Microsoft Technet. 2009. Retrieved 2011-07-03.
- ↑ "Boot Configuration Data Editor Frequently Asked Questions". Windows Server. Microsoft Technet. 2007. Retrieved 2011-07-03.
- ↑ Windows 2000 Server
- ↑ Microsoft (2000). Windows 2000 Professional Resource Kit (1st ed.). Redmond, WA: Microsoft Press. ISBN 1-57231-808-2.
- ↑ Rick Maybury, Startup and Shutdown Problems, part 1, Bootcamp, 2009, accessed 25 April 2012
- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Microsoft (November 28, 2007). "Available switch options for the Windows XP and the Windows Server 2003 Boot.ini files". Retrieved August 19, 2009.
- 1 2 3 4 5 6 7 8 9 10 11 12 Russinovich, Mark (November 1, 2006). "Boot INI Options Reference". Windows Sysinternals Library on TechNet. Microsoft. Archived from the original on 2008-04-30. Retrieved August 19, 2009.
- ↑ http://forum.videohelp.com/threads/292160-Loss-of-DirectDraw-Overlay-and-VMR9-after-upgrade-update
- ↑ MSDN: /BURNMEMORY specification
- 1 2 3 4 5 A description of the Safe Mode Boot options in Windows XP
- ↑ Programs that use the QueryPerformanceCounter function may perform poorly in Windows Server 2000, in Windows Server 2003, and in Windows XP
External links
- How to edit the Boot.ini file in Windows XP
- BOOT.INI and ARC Path Naming Conventions and Usage
- MS Knowledge Base help on "NTLDR Is Missing" error message in Windows 2000 and Windows XP (also , , , )
- How to fix "NTLDR Is Missing" error
- Explanation of BOOT.INI by Daniel B. Sedory