1. Introducing the Windows 7 Boot Environment
Windows computers can use several different processor architectures,
several different types of firmware, and several different disk
partitioning styles. Generally, computers with 32-bit x86-based processors
use the Master Boot Record (MBR) disk partitioning style and BIOS.
Computers with Itanium-based IA64 processors use the GUID Partition Table (GPT) disk partitioning style and
Extensible Firmware Interface (EFI). Computers with 64-bit
x64-based processors use the MBR disk partitioning style and Unified Extensible Firmware Interface (UEFI) which is
wrapped around either BIOS or EFI.
Every computer has firmware. Firmware is implemented in
motherboard chipsets. Just as Windows has an interface, so
does firmware. The interface between the platform firmware and the
operating system that handles the startup process. The way a firmware
interface works and the tasks it performs depend on the type of firmware
interface. Windows computers can use different types of firmware.
Generally, computers with 32-bit x86-based processors use
BIOS. Computers with Itanium-based IA64 processors use EFI.
Computers with 64-bit x64-based processors use UEFI, which is wrapped
around either BIOS or EFI. For the purposes of this discussion, a computer
that uses UEFI wrapped around BIOS is BIOS-based and a computer that uses
UEFI wrapped around EFI is EFI-based.
If you are familiar with the way Windows XP and earlier versions of
Windows start, you know these versions of Windows uses Boot.ini to initialize the startup environment
and Ntldr to load the operating
system. Windows Vista and Windows 7 don’t use these boot facilities.
Instead, startup is controlled using the parameters in the BCD data
store:
Entries in the BCD data store identify the boot manager to use
during startup and the specific boot applications available.
Windows Boot Manager controls the boot experience and enables
you to choose which boot application is run.
Boot applications load a specific operating system or operating
system version. For example, a Windows Boot Loader application loads
Windows 7.
Because BCD abstracts the underlying firmware, you can boot
BIOS-based and EFI-based computers in much the same way—just as you can
computers based on other firmware models. The BCD store is contained in a
file called the BCD registry. On BIOS-based operating
systems, the BCD registry file is stored in the \Boot\Bcd file of the hidden System Reserved
partition that Windows 7 creates. This partition is visible in the Disk
Management MMC Snap-In, but it is not assigned a drive letter by default.
On EFI-based operating systems, the BCD registry file is stored on the EFI
system partition.
The BCD store contains multiple entries. On a BIOS-based computer,
you’ll have one Windows Boot Manager entry. There is only one boot
manager, so there is only one boot manager entry. You’ll also have Windows
Boot Loader application entries, with one entry for each instance of
Windows Vista, Windows 7 or a later version of Windows installed on the
computer.
On a computer with Windows XP or earlier operating systems installed
in addition to Windows Vista, Windows 7 or later, you’ll have one legacy
operating system entry. The legacy entry is not for a boot application.
This entry is used to initiate Ntldr
and Boot.ini so that you can boot
into a pre–Windows Vista operating system. If the computer has more than
one pre–Windows Vista operating system, you’ll be able to select the
operating system to start after selecting the legacy operating system
entry.
2. Working with Boot Configuration Data
Several tools are available to work with and manage the BCD,
including the following:
The following sections discuss how these tools are used.
2.1. Using the Startup and Recovery Dialog Box
The Startup and Recovery dialog box enables you to select
the default operating system to start if you have multiple operating
systems installed on your computer. You can also specify timeout values
for operating system selection lists and recovery options.
You can access the Startup and Recovery dialog box by following
these steps:
![](http://programming4.us/image/022011/Working%20with%20Boot%20Configuration%20Data_1.jpg)
Click Start→Control Panel. In the Control Panel, click System
and Security and then click System.
In the System utility, click “Advanced system settings” in the
left pane.
On the Advanced tab of the System properties dialog box, click
Settings under Startup and Recovery. This displays the Startup and
Recovery dialog box, as shown in Figure 1.
Use the “Default operating system” drop-down list to specify
the default operating system.
Set the timeout interval for the operating system list by
selecting the “Time to display list of operating systems” checkbox
and specifying a timeout in seconds in the field provided.
Set the timeout interval for the recovery options list by
selecting the “Time to display recovery options when needed”
checkbox and specifying a timeout in seconds in the field
provided.
2.2. Using the System Configuration Utility
Using the System Configuration utility (Msconfig.exe), you can set the default
operating system and control the way your computer starts. For example,
you can configure the computer to start in Safe Mode or force the computer to use standard VGA
display settings.
![](http://programming4.us/image/022011/Working%20with%20Boot%20Configuration%20Data_2.jpg)
The basic steps for starting and using the System Configuration
utility are as follows:
Click Start, type msconfig.exe in the Search box and press
Enter.
Select the Boot tab, as shown in Figure 2.
To set the default operating system, click the operating
system you want to use and then click “Set as default.”
To start the operating system in Safe Mode for
troubleshooting, select the “Safe boot” checkbox and then set other
troubleshooting options as appropriate.
Click OK to apply your changes.
If you are using the System Configuration utility for
troubleshooting, you must later remove your selective startup options.
After you restart the computer and resolve any problems, access the
System Configuration utility again, select Normal Startup on the General
tab, and then click OK.
2.3. Using the BCD Editor
The BCD Editor (BCDEdit.exe) is the only tool that gives you
direct access to view and manage the BCD data store. You can use
BCDEdit to view the entries in the
BCD store by following these steps:
Click Start, click All Programs, and then click
Accessories.
Right-click Command Prompt and then select Run As
Administrator.
Type bcdedit at the
command prompt.
Example 1 shows an
example of the output from BCDEdit.
As the listing shows, the BCD store for this computer has three entries:
one for the Windows Boot Manager, one for the Windows Legacy OS
Loader, and one for the Windows Boot Loader.
Example 1. Examining the contents of the BCD data store
-------------------- Windows Boot Manager -------------------- identifier {9dea862c-5cdd-4e70-acc1-f32b344d4795} device partition=C: description Windows Boot Manager locale en-US inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e} default {1cafd2e9-e035-11dd-bbf6-bdebeb67615f} resumeobject {1cafd2e8-e035-11dd-bbf6-bdebeb67615f} displayorder {1cafd2ed-e035-11dd-bbf6-bdebeb67615f} {1cafd2e9-e035-11dd-bbf6-bdebeb67615f} {360a7720-e6ef-11dc-89b8-84b5c301f2c8} toolsdisplayorder {b2721d73-1db4-4c62-bf78-c548a880142d} timeout 30
Windows Legacy OS Loader ------------------------ Identifier: {ntldr} Type: 10300006 Device: partition=C: Path: \ntldr Description: Earlier Version of Windows Boot debugger: No
Windows Boot Loader ------------------- identifier {1cafd2e9-e035-11dd-bbf6-bdebeb67615f} device partition=C: path \Windows\system32\winload.exe description Windows 7 locale en-US inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7} recoverysequence {1cafd2f0-e035-11dd-bbf6-bdebeb67615f} recoveryenabled Yes osdevice partition=C: systemroot \Windows resumeobject {1cafd2e8-e035-11dd-bbf6-bdebeb67615f} nx OptIn
|
The Windows Boot Loader entry has parameters that track the status
of the no execute (NX) policy, integrity checking, kernel debugger mode,
and Emergency Management Services (EMS). Although the Windows Boot
Manager, Windows Legacy OS Loader, and Windows Boot Loader are the
primary types of entries that control startup, the BCD also stores
information about preoperating system boot environment utilities and
settings. To view the BCD entries for utilities and settings, use the
following command line:
bcdedit /enum all /v
This command line enumerates all BCD entries, regardless of their
current state, and lists them in Verbose Mode. Example 2 shows the verbose entries. It
is important to note that Verbose Mode provides the actual value of the
GUIDs needed to manipulate entries in the BCD data store.
Example 2. Viewing extended BCD entries
-------------------- identifier {9dea862c-5cdd-4e70-acc1-f32b344d4795} device partition=C: description Windows Boot Manager locale en-US inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e} default {1cafd2e9-e035-11dd-bbf6-bdebeb67615f} resumeobject {1cafd2e8-e035-11dd-bbf6-bdebeb67615f} displayorder {1cafd2ed-e035-11dd-bbf6-bdebeb67615f} {1cafd2e9-e035-11dd-bbf6-bdebeb67615f} {360a7720-e6ef-11dc-89b8-84b5c301f2c8} toolsdisplayorder {b2721d73-1db4-4c62-bf78-c548a880142d} timeout 30
Windows Boot Loader ------------------- identifier {1cafd2e9-e035-11dd-bbf6-bdebeb67615f} device partition=C: path \Windows\system32\winload.exe description Windows 7 locale en-US inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7} recoverysequence {1cafd2f0-e035-11dd-bbf6-bdebeb67615f} recoveryenabled Yes osdevice partition=C: systemroot \Windows resumeobject {1cafd2e8-e035-11dd-bbf6-bdebeb67615f} nx OptIn
Windows Boot Loader ------------------- identifier {1cafd2e0-e035-11dd-bbf6-bdebeb67615f} device ramdisk=[C:]\Recovery\1cafd2e0-e035-11dd-bbf6-bdebeb6761 5f\Winre.wim,{1cafd2e1-e035-11dd-bbf6-bdebeb67615f} path \windows\system32\winload.exe description Windows Recovery Environment inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7} osdevice ramdisk=[C:]\Recovery\1cafd2e0-e035-11dd-bbf6-bdebeb6761 5f\Winre.wim,{1cafd2e1-e035-11dd-bbf6-bdebeb67615f} systemroot \windows nx OptIn winpe Yes
Resume from Hibernate --------------------- identifier {1cafd2e8-e035-11dd-bbf6-bdebeb67615f} device partition=C: path \Windows\system32\winresume.exe description Windows Resume Application locale en-US inherit {1afa9c49-16ab-4a5c-901b-212802da9460} filedevice partition=C: filepath \hiberfil.sys debugoptionenabled No
Windows Memory Tester --------------------- identifier {b2721d73-1db4-4c62-bf78-c548a880142d} device partition=C: path \boot\memtest.exe description Windows Memory Diagnostic locale en-US inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e} badmemoryaccess Yes
Windows Legacy OS Loader ------------------------ identifier {466f5a88-0af2-4f76-9038-095b170dc21c} device unknown path \ntldr description Earlier Version of Windows custom:45000001 1 custom:47000005 301989892
EMS Settings ------------ identifier {0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9} bootems Yes
Debugger Settings ----------------- identifier {4636856e-540f-4170-a130-a84776f4c654} debugtype Serial debugport 1 baudrate 115200
RAM Defects ----------- identifier {5189b25c-5558-4bf2-bca4-289b11bd29e2}
Global Settings --------------- identifier {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e} inherit {4636856e-540f-4170-a130-a84776f4c654} {0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9} {5189b25c-5558-4bf2-bca4-289b11bd29e2}
Boot Loader Settings -------------------- identifier {6efb52bf-1766-41db-a6b3-0ee5eff72bd7} inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e} {7ff607e0-4395-11db-b0de-0800200c9a66}
Hypervisor Settings ------------------- identifier {7ff607e0-4395-11db-b0de-0800200c9a66} hypervisordebugtype Serial hypervisordebugport 1 hypervisorbaudrate 115200
Resume Loader Settings ---------------------- identifier {1afa9c49-16ab-4a5c-901b-212802da9460} inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
Device options -------------- identifier {1cafd2dd-e035-11dd-bbf6-bdebeb67615f} description Ramdisk Options ramdisksdidevice partition=C: ramdisksdipath \Recovery\1cafd2dc-e035-11dd-bbf6-bdebeb67615f\boot.sdi
Device options -------------- identifier {1cafd2e1-e035-11dd-bbf6-bdebeb67615f} description Ramdisk Options ramdisksdidevice partition=C: ramdisksdipath \Recovery\1cafd2e0-e035-11dd-bbf6-bdebeb67615f\boot.sdi
|
As you can see from the listing, there
are a number of additional entries. Each entry has a specific purpose,
and lists values that you can set, including the following:
- Recovery Environment
In the Windows Boot Loader entries, you’ll find
entries that have a description of “Windows Recovery Environment.”
The Windows Recovery Environment is a custom preinstallation
environment that includes components for recovery and startup
troubleshooting. To enable rapid recovery, the Windows Recovery
Environment (Windows RE) is installed with Windows 7
automatically. Normally, Windows RE is installed on a hard disk
partition other than the one containing the Windows installation.
This ensures that Windows RE is separate from the operating
system.
- Resume from Hibernate
The Resume from Hibernate entry shows the current
configuration for the resume feature in Windows 7. The
preoperating system boot utility that controls resume is Winresume.exe, which in this example is
stored in the C:\Windows\system32 folder. The
hibernation data, as specified in the filepath parameter, is stored in the
Hiberfil.sys file in the root
folder on the filedevice
(c: in this example). Because
the resume feature works differently if the computer has Physical
Address Extension (PAE) and debugging enabled, these options are
tracked by the PAE and Debugoptionenabled
parameters.
- Windows Memory Tester
The Windows Memory Tester entry shows the current
configuration for the Windows Memory Diagnostics utility. The
preoperating system boot utility that controls memory diagnostics
is Memtest.exe, which in this
example is stored in the \boot folder of the hidden System
Reserved partition. Because the memory diagnostics tool is
designed to detect bad memory by default, the badmemoryaccess parameter is set to
yes by default.
- EMS Settings
The EMS Settings entry shows the configuration used
when booting with Emergency Management Services. Individual
Windows Boot Loader entries control whether EMS is enabled.
- Debugger Settings
The Debugger Settings entry shows the configuration
used when booting with the debugger turned on. Individual Windows
Boot Loader entries control whether the debugger is enabled. When debug
booting is turned on, Debugtype
sets the type of debugger as SERIAL, 1394, or USB. With SERIAL debugging, Debugport specifies the serial port
being used as the debugger port and Baudrate specifies the baud rate to be
used for debugging. With 1394 debugging, you can use Channel to set the debugging channel.
With USB debugging, you can use Targetname to set the USB target name to
be used for debugging.