Biko's House of Horrors

Notes on setting up the Windows 98 DDK

For Reasons™, I needed to be able to compile and debug drivers for Windows 98. This meant setting up the DDK (Driver Development Kit) and Visual C++. So that this knowledge isn't lost, here's a quick guide.1

Prerequisites

  1. A Windows 98 ISO.
  2. The DDK.
  3. Visual C++ 5.0.

Installation

  1. Install Windows on a VM.
    • WinWorld says that Windows 98 might have trouble running on a VM, so you may want to consider 86Box or PCem instead.
    • In any case, make sure the VM has a serial port exposed to the host (through a pipe or some such).
  2. Install Visual C++.
    • To be on the safe side, install everything.
  3. Install the DDK.
    • Again, install everything.
    • Important: increase the environment space by adding the following line to config.sys: shell=c:\command.com /p /e:4096
  4. Check the installation by building the samples.
    • Open a "Checked Build Environment" command prompt from the start menu, go to C:\98DDK\src, and run build -cZ
    • There will be a few errors, but most of the samples will compile. The binaries will be at C:\98DDK\lib\i386\checked.
  5. Check that debugging works.
    1. Reboot into DOS mode and run \98ddk\bin\wdeb386 /c:1 /r:19200 \windows\win.com
      • This starts the debugger on COM port 1 (on the guest), with a baud rate of 19200, and instructs it to run the kernel at \windows\win.com.
    2. On the host, connect to the VM's serial port with the correct baud rate and press Ctrl-C.
      • The debugger should break in (see screenshot below).
    3. Enter g to resume execution.
  6. Make sure the debugger starts on boot.
    1. Add the following line to config.sys: DEVICE=C:\98ddk\bin\wdeb386.exe /c:1 /r:19200
      • Note: I'm not sure about the importance of the line order in this file. In my setup this line comes before the one that increases environment space (see screenshot below).
    2. Reboot and check that this works. On boot, the debugger should print a version string (see screenshot below).

Note: the debugger we're using here is WDEB386. There's a better debugger installed with the DDK — WDEB98 — but it requires the use of a special client — RTerm98 — which complicates matters. So that we can use PuTTY, we're sticking with the old debugger.

Building drivers

Now that the environment is all set up, you may want to actually write your own driver in it. Here's a gist of a minimal WDM driver project. To build it:

  1. Put all files in the same directory.
  2. Inside said directory, create the path bin\i386\checked
  3. Open a "Checked Build Environment" command prompt.
  4. From within the directory, run build -cZ

To make the driver load on boot, place the binary in C:\WINDOWS\SYSTEM32\DRIVERS and run the supplied .reg file.

Fun fact: the built binary also runs on Windows 10 😎.

Screenshots

Final config.sys

Screenshot of the final config.sys file

Debugger break-in

Screenshot of a debugger break-in, showing register values and the current instruction

Boot with debugger

Screenshot of debugger output during boot, showing the version string

Driver output

Screenshot of the sample driver's debugger output, showing the string "Hello from Windows 9x!"


  1. This may or may not be related to some previous shenanigans↩︎