5

In Windows 9x, the MSDOS.SYS configuration file contains a [Paths] section whose contents usually look like this:

[Paths]
WinDir=C:\WINDOWS
WinBootDir=C:\WINDOWS
HostWinBootDrv=C

Both WinDir and WinBootDir point to the Windows installation directory, which usually is C:\WINDOWS, and HostWinBootDrv points to the drive letter containing it. Having distinct settings suggests that potentially these could be different. Are there situations where this is the case? Why are there three different settings at all? What is their purpose anyway?

9

HostWinBootDrv is the easiest to explain: it has to do with disk compression, i.e. DoubleSpace/DriveSpace. What DriveSpace does is create a file with a name like DRVSPACE.nnn (with nnn being a three-digit number) that contains the compressed contents of the disk. The compressed file system is assigned the drive letter of the partition containing the file, and the latter (called the host drive in this context) is assigned another drive letter, or sometimes hidden entirely. If the partition from which Windows starts is compressed, HostWinBootDrv points to the host drive of that partition, which by default is H, while the other settings point to the compressed file system.


As for WinDir and WinBootDir, what they do is relatively easy to discover. Some experimentation reveals the following:

WinDir points to the directory in which Windows is installed. The presence of WinDir in MSDOS.SYS is what instructed IO.SYS (before Windows Me) that there was a Windows installation present that it should be prepared to launch (as opposed to just booting to a command prompt, like on an emergency boot floppy). If WinDir is set, the real-mode kernel will do the following:

  • Put two entries in the PATH environment variable: the directory pointed to by WinDir and its subdirectory COMMAND;
  • Create a subdirectory TEMP under this directory and point the environment variables TEMP and TMP to it;
  • Clear a flag, returned by interrupt 0x2f service 0x1611 in BL register bit 5, which COMMAND.COM checks to decide whether to launch WIN.COM after processing AUTOEXEC.BAT;
  • Start the device configuration manager before processing CONFIG.SYS (this can be suppressed by the SystemReg=0 setting in the [Options] section)
  • Look for certain critical files in this directory, including SYSTEM.DAT (the Registry), COMMAND.COM (which will fall back to the root directory if absent) and real-mode drivers like HIMEM.SYS and IFSHLP.SYS (which can be suppressed by setting DOS=NOAUTO in CONFIG.SYS);
  • Store the directory itself in the winbootdir environment variable (all-lowercase!).

The last two of these is what can be overridden by setting WinBootDir: if that setting is present as well, those files will be looked up in WinBootDir instead, and of course it’s that directory which will end up in the winbootdir environment variable.

There are some wrinkles here however, for example with respect to WIN.COM. When the AUTOEXEC.BAT file is absent, empty or being skipped (like e.g. in Safe Mode), COMMAND.COM is not loaded and the real-mode kernel will instead directly execute WIN.COM from WinBootDir. However, if AUTOEXEC.BAT is present, COMMAND.COM will be launched to process it, after which it will in turn execute the command WIN, launching WIN.COM… by looking it up in PATH, which by default points to WinDir.


Well, great, but why are WinDir and WinBootDir separate settings at all? It is still not entirely clear to me, but from what little I can gather, it was probably meant to support booting Windows over a LAN. In such a configuration, DOS would first be loaded from a normal file system (or even itself from a disk image downloaded over the network), load essential drivers like HIMEM.SYS from WinBootDir located on the same file system, then load DOS network drivers, map a share (containing WinDir) to its drive letter, and then continue booting from there. If that’s the intended scenario, then even the WIN.COM oddity starts making sense now: there could be a ‘main’ Windows copy started when booting normally from WinDir, and another minimal ‘emergency’ copy booted in Safe Mode from WinBootDir, when network boot fails.

In any case, the requirements of this scenario could easily require those two settings to have different values. Here’s a short fragment from a document describing just such a configuration:

D-2. MSDOS.SYS Sample File for DM9102 :
=======================================

      [Paths]
      WinDir=g:\client1
      WinBootDir=d:\winboot     <== According to RAMDRIVE.SYS assign
      HostWinBootDrv=c              Virtual Drive (D: or E:)

There is also a paper and a series of articles by Micho Durdevich (part 1, 2, 3, 4, 5 and 6) that describe how to achieve network boot with Windows 9x.

They are somewhat scant on the details of how this all worked, but both those sources mention a SETMDIR utility, which is distributed as part of Windows 95. This implies that network booting was probably a use case intended by Microsoft.

| improve this answer | |
  • If you run DOS by itself, windir is not created, and you get winblotdir and its subdirectory command. WIn is just any command. You can use a command that says 'hello world' there. – wendy.krieger Sep 23 at 6:20
2

Winbootdir points to the directory that DOS startup files are in. It can be different to Windir.

Windir points to the directory that the user's registry is in. On a network this can be different to where windows is installed.

Winbootdir is used if there is no config.sys/autoexec.bat, to load the drivers like himem.sys, ifs$hlp.sys, and co. It could be on a boot image sent through the network, for example.

Windir as in 3.0, needs to contain win.com, but win.com is then responsible for starting windows (by running win32.vxd or something.)

== Edit ==

http://reboot.pro/topic/22047-dual-boot-msdos-710-and-630/

This post describes the creation of a minimal DOS setup, using the DOS from Win98se, and a slightly modified MS-DOS 6.22.

Exanples of what happens when winbootdir and windir are changed. The command setmdir changes windir after the system is booted, we are not using it here.

http://reboot.pro/topic/18130-ms-dos-7-help-file/

This topic contains the working comments for creating a qbasic help file for DOS 5 to 7 (ie as a replacement for what's on the CDROM).

https://www.betaarchive.com/forum/viewtopic.php?f=72&t=34798&p=401645#p401645

This is where we are documenting running multiple Windows 9x versions as options in the config.sys. So far we have overcome most of the problems in launching Win95 from DOS98SE.

https://www.betaarchive.com/forum/viewtopic.php?f=60&t=41489

This is progress on running Windows 95 and ME from DOS98SE. It has a link to the DOS files used in the experiments.

All of these experiments are based on VPC sessions that do what is described. For example, after Offer posted the construction of c:\MSDOS7, i ran the experiment with several NT5x over the top of different Win98 and ME installs, in English and in German. It's where I got the idea of using c:\msdos7 from.

| improve this answer | |
  • ‘Windir points to the directory that the user's registry is in’ — wrong, and I checked this. For example, interrupt 0x2f service 0x1613 returns a path in WinBootDir. The rest of this answer is so sloppy and vague that I seriously doubt its usefulness. – user3840170 Sep 23 at 18:52
  • Except, this is based on actual setups. A dos7 booted without windows has a winbootdir but no windir. The utility setmdir is a network utility for changing windir. See reboot.pro/topic/22047-dual-boot-msdos-710-and-630 for one of the experiments. – wendy.krieger Sep 24 at 0:53
  • You can run Windows 3.1 and 98, if you separate the DOS out of Win98 (eg to msdos7), point winbootdir to c:\msdos7, and windir to '.', This is how Wengier's DOS 7,1 does it, To start either version of windows, change to the windows directory and type 'win'. A fault exists in the Win31 win386.exe that garbles the dos dir after exit, if not in the root directory, but a patch exists for this. In such a system the registry (in win98, it's system.dat and user.dat, not 'registry.dat'), is not found, and windir is not set in DOS, but by Windows. – wendy.krieger Sep 24 at 5:39
  • ‘A dos7 booted without windows has a winbootdir but no windir’ — also wrong, when the WinDir setting is absent, WinBootDir is ignored even if present. DOS boot floppies created by Windows 9x lack either. – user3840170 Sep 26 at 8:37
  • If you install NT5 or later over Windows 98 or ME, then there is a directory of DOS files, left in c:\msdos7. To this, there is also some files in the root directory (io.sys, msdos.sys and boot.dos). Boot.dos is to be added to the NT boot.ini. MSDOS.SYS contains pointers to windir and winbootdir toc:\MSDOS7, with logo=0 and bootgui=0. The environment created can be seen (and changed), in IO.SYS. The environment contains TMP, TEMP, PROMPT, winbootdir, PATH and COMSPEC. The PATH contains C:\MSDOS7;C:\MSDOS7\COMMAND. – wendy.krieger Sep 26 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.