Module-Definition Files

To build a device-driver DLL, you must have a module-definition (.DEF) file. From this file, you export entry-point functions. Note that the DriverProc entry point must be exported for all drivers. If you are writing a waveform, MIDI, mixer, or auxiliary driver, you must export additional entry-point functions, as specified in the following list:

Example .DEF File

The .DEF file exports entry-point functions, as shown in the following example taken from the MSSB16.DEF file:


LIBRARY     MSSB16

DESCRIPTION 'wave,aux,mixer:Creative Labs Sound Blaster 16 Driver'

EXETYPE     WINDOWS
PROTMODE

CODE        MOVEABLE DISCARDABLE LOADONCALL
DATA        FIXED SINGLE PRELOAD

SEGMENTS    _TEXT     FIXED                PRELOAD
            WEP_TEXT  FIXED                PRELOAD
            INIT      MOVEABLE DISCARDABLE PRELOAD
            COMMON    MOVEABLE DISCARDABLE PRELOAD
            MIXER     MOVEABLE DISCARDABLE PRELOAD
            WAVE      MOVEABLE DISCARDABLE PRELOAD

HEAPSIZE    2048

EXPORTS     WEP             @1          RESIDENTNAME
            DriverProc      @2          RESIDENTNAME
            wodMessage      @3          RESIDENTNAME
            widMessage      @4          RESIDENTNAME
            auxMessage      @5          RESIDENTNAME
            mxdMessage      @6          RESIDENTNAME

For more information about the entry-point function listed in this example, see .

In this example, functions are exported by ordinal. The actual ordinal values you assign to each exported function are not significant, though each must be unique within the DLL.

Module-Name Line

The module-name line should specify a unique module name for your device driver. Windows will not load two different modules with the same module name. It's a good idea to use the base of your driver filename because, in certain instances, LoadLibrary assumes that to be your module name. For example, here's the module-name line from the first example in the previous section:


LIBRARY     MSSB16

Module-Description Line

The module-description line in the module-definition file should specify the type of device the driver supports. The content of this line varies for each type of driver.

The Multimedia option in the Control Panel uses the name in the module-description line to identify different types of drivers and to create the entry in the [drivers] section of SYSTEM.INI when installing a driver.

Module-Description Line for Video-Capture Drivers

To indicate that a driver is a video-capture driver, use MSVIDEO followed by a colon (:) in the module-description line.

The Bravado driver is an example of a video-capture driver. The module-description line from the Bravado driver is the following:


DESCRIPTION 'MSVIDEO: Truevision Bravado Driver'
Module-Description Line for Video-Compression Drivers

To specify a video-compression driver, include the keyname of VIDC, a period (.), and the four-character code for your driver in the DESCRIPTION entry. Use a colon (:) to separate this entry from the text description.

The ICSAMPLE.DRV driver is an example of a video-compression driver. The module-description line from this driver is the following:


DESCRIPTION 'VIDC.SAMP:Sample Decompression Driver'

If you are using a custom-installation application instead of assuming installation through the Multimedia option in Control Panel, you do not need to include this description information.

Module-Description Line for Audio Compression Drivers

It is not necessary to include a keyword to specify an ACM driver. Instead, use a text string that fully describes the driver. For example, the following is the module-description line for the IMA ADPCM driver:


DESCRIPTION 'Microsoft Audio Compression Manager IMA ADPCM CODEC'