The Module-Definition File

To build a device-driver DLL, you must have a module-definition (.DEF) file. In the module-definition file, you must export at least two of the following entry-point functions:

Functions are exported by ordinal, as shown in the following example 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

The actual ordinal values you assign to each exported function are not significant, though each must be unique within the DLL. For more information on the entry-point functions listed in this example, see .

The 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 since, in certain instances, LoadLibrary will assume that to be your module name. For example, the previous fragment used LIBRARY MSSB16.

The Module Description Line

The module description line in the module-definition file should specify the type of device the driver supports. For example, here is the module description line from the module-definition file for the Sound Blaster driver:


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

The beginning of the module description indicates the driver supports waveform, auxiliary, and mixer devices. Use one of the following device-type names, followed by a colon (:) to indicate the type of device your driver supports. If the driver supports more than one type of device, separate each device-type name with a comma (,).