1.1  Determining Required I/O Support by Device Object Type

Every kernel-mode driver must set an appropriate value in the Type field of its device objects when they are created. This value determines which IRP_MJ_XXX a device or intermediate driver must handle.

The system device and intermediate drivers set one of the following system-defined constants in the Type fields of their respective device objects:

FILE_DEVICE_BEEP

FILE_DEVICE_CD_ROM

FILE_DEVICE_CONTROLLER

FILE_DEVICE_DISK

FILE_DEVICE_INPORT_PORT

FILE_DEVICE_KEYBOARD

FILE_DEVICE_MIDI_IN

FILE_DEVICE_MIDI_OUT

FILE_DEVICE_MOUSE

FILE_DEVICE_NULL

FILE_DEVICE_PARALLEL_PORT

FILE_DEVICE_PRINTER

FILE_DEVICE_SCANNER

FILE_DEVICE_SERIAL_MOUSE_PORT

FILE_DEVICE_SERIAL_PORT

FILE_DEVICE_SCREEN

FILE_DEVICE_SOUND

FILE_DEVICE_TAPE

FILE_DEVICE_UNKNOWN

FILE_DEVICE_VIDEO

FILE_DEVICE_VIRTUAL_DISK

FILE_DEVICE_WAVE_IN

FILE_DEVICE_WAVE_OUT

FILE_DEVICE_8042_PORT

The FILE_DEVICE_Xxx constants are defined in ntddk.h.

The FILE_DEVICE_DISK specification covers both floppy and fixed-disk devices, as well as disk partitions.

Intermediate drivers usually set the Type fields of their respective device objects to that of the underlying device. For example, the system supplied fault-tolerant disk driver, ftdisk, has device objects of type FILE_DEVICE_DISK; it does not define new FILE_DEVICE_XXX values for the mirror sets, stripe sets, and volume sets it manages.

File system and network drivers set other system-defined FILE_DEVICE_XXX in the Type fields of their respective device objects.

FILE_DEVICE_XXX values in the range 0–32767 are reserved to Microsoft. All driver writers must use one of these system-defined constants for new drivers when the underlying device corresponds to a type in the preceding list.

However, a driver designer can define another FILE_DEVICE_XXX for a new kind of device. Values in the range 32768–65535 are available for Microsoft customers who develop new kinds of kernel-mode drivers for Windows NT.