Coping with the complications of a multiboot environment

Windows NT has become my OS of choice on my main Intel machines, but I still have plenty of occasions when I need to load MS-DOS, Windows (or Windows for Workgroups) 3.X, and of course, Windows 95. Fortunately, both NT and Win95 let me choose an OS at boot time. A multiboot environment lets me select the most appropriate OS for the task at hand. However, booting multiple OSs can be confusing and a reminder that "PC-compatible" machines are still tightly tied to the restrictions left from the original PC design. Keeping these considerations in mind, I'm going to explain the gross and disgusting things that happen behind the screens in a multiboot environment.

Let's start with a little trip in our way-back machine to a time when 640KB of memory and a 10MB, 85 millisecond disk seemed like incredible resources. When IBM designed the original PC in the early 1980s, the designers realized they had to accommodate different OSs. After all, IBM had been in the OS business for a long time and knew that OSs grow and change. This design decision turned out to be fortunate foresight because it lets us run IBM, Microsoft, and UNIX-flavored OSs on PC-compatible systems.

Under the original PC design, the BIOS program controls the disk boot process, which was (and still is) burned into a ROM chip. This design uses the same boot process whether you boot from a floppy diskette or a hard disk. The boot process begins by reading the first physical sector on the disk (sector 0). This sector, the boot sector, contains two important structures. The first identifies the characteristics of the disk, such as which OS you used to format the disk, its logical organization (e.g., a DOS File Allocation Table--FAT--format), and the disk's physical organization (e.g., the number of sectors per track and number of heads).

The second structure in the boot sector is a small "bootstrap" program that the BIOS loads and runs when it starts. This program's purpose is to find the initial OS files on the disk and then load and run them. For example, in an MS-DOS environment, the bootstrap program checks to make sure the io.sys and msdos.sys hidden files are on the disk and loads and runs them to start the OS. We become so accustomed to dealing with hidden files (e.g., io.sys and msdos.sys for MS-DOS or and for PC-DOS) that we often forget the initial bootstrap program--at least until we upgrade to Win95 or NT.

New-Age Bootstrap
Both Win95 and NT write a new bootstrap program into the boot sector when you upgrade. However, Win95 and NT rely on different bootstrap programs, which makes life interesting if you want NT, Win95, and DOS/Windows to coexist. To understand all the complications, you need to look at both bootstrap processes. I'll start with NT's easier, more straightforward process.

When you install NT on a DOS/Windows FAT-format drive, the NT setup process updates the boot sector with a bootstrap program configured to run the general-purpose ntldr program (which Microsoft calls the Flex Boot Loader). When the ntldr program runs, it looks for a hidden file named boot.ini to determine what startup options are in effect. For example, the boot.ini file on a system that can run DOS, NT Server, or NT Workstation looks like listing 1.

The boot.ini file defines the default OS that ntldr will load (NT Server in the example), the amount of time ntldr waits to override the default selection (30 seconds in the example), the list of OSs you can load, and their location (e.g., the hard disk and partition assignments).

The results of ntldr processing the boot.ini file appear as an on-screen menu during the boot process. If you do nothing, the default OS will load after the timeout period expires. To load an alternative OS (or if you set the timeout period to an infinite wait), you can use the keyboard arrow keys to select the OS you want and press Enter to start the load. If you select NT, ntldr will begin loading the appropriate files from the disk and directory specified in the boot.ini file. If you select MS-DOS, ntldr will load...well, let's put that thought on hold until we discuss the Win95 bootstrap program.

New-Age Alternative Bootstrap
When you install Win95 on a DOS/Windows FAT-format drive and request dual-boot mode, the Win95 setup process updates the boot sector with a bootstrap program. That program makes sure Win95 boots, regardless of which OS was last used. This process is much more complicated than NT's generalized boot process. The complications come from Win95 messing around with the io.sys and msdos.sys hidden files when you install it in a dual-boot environment.

Here's how it works. When you run Win95, the MS-DOS versions of the io.sys and msdos.sys files are renamed io.dos and msdos.dos. Win95 then replaces those files with its versions of io.sys and msdos.sys. When the bootstrap program runs, it just starts the program in io.sys. The io.sys program gives you the opportunity to press F4 or F8 to bring up a boot menu so you can boot into the MS-DOS environment. Otherwise, io.sys starts Win95.

If you boot to MS-DOS, the io.sys program does some tricky things. First, it renames the Win95 io.sys file to winboot.sys and the msdos.sys file to msdos.w40 (at least on my system--I suspect the file extension changes, depending on environmental parameters). The io.sys program then renames io.dos and msdos.dos back to io.sys and msdos.sys. Then, the io.sys program transfers control to the DOS version of io.sys, and DOS loads as usual.

Now here's where the boot process gets tricky. When you reboot your system after running MS-DOS, the Win95 boot program is still in the winboot.sys file. In this case, the bootstrap program detects this file and loads it instead of the io.sys file (which at that point still contains the MS-DOS version of the io.sys program). If you continue to boot Win95, the boot program moves the files so that the MS-DOS io.sys and msdos.sys files are renamed io.dos and msdos.dos, and the winboot.sys and msdos.w40 files are renamed io.sys and msdos.sys. Pretty crazy, eh?

When NT Meets 95
NT and Win95 have different approaches to dual booting with DOS. So what happens when you use DOS/Windows with Win95 and NT in the same multiple-boot environment?

To answer that question, let's go back to our discussion of ntldr. The same logic that the Win95 bootstrap program uses is also in the ntldr program. So when you request ntldr to boot MS-DOS, ntldr looks for the winboot.sys file and runs it if it is present. Otherwise, ntldr runs the io.sys file and loads whatever OS the file has (MS-DOS or Win95). But won't you override the NT bootstrap program if you install Win95 after NT? Nope. The final release of Win95 is NT-aware; it detects the NT bootstrap program and leaves it alone.

Is this an ideal solution for NT/
Win95/DOS/Windows coexistence? Absolutely not, because this environment imposes multiple levels of boot menus. For example, if you are running NT, Win95, and MS-DOS on the same computer and you want to boot MS-DOS, you must first tell the ntldr program you want it to boot MS-DOS; then tell the Win95 io.sys/winboot.sys programs you want to boot MS-DOS; and if you use the MS-DOS multiple configuration feature, you must also pick a DOS environment to boot into. These, my friend, are a lot of menus to navigate just to get to a C prompt. Oh sure, it's better than juggling multiple boot diskettes to load your OS of choice--but not by much.