Share via


Block Driver Interface

Block drivers should expose the stream interface. For more information about the stream interface, see Stream Interface Drivers.

The prefix "DSK_" is customary for block devices, which often include disk drives and other mass storage media. However, block drivers can have any legal device file name prefix. For more information about device file name prefixes, see Device File Names Prefixes. The reference entries for the functions listed above describe the sample implementations of these functions. You can modify the semantics of these functions, but not the syntax, to suit the capabilities of your device.

In addition to the exposing the stream interface, the block device driver must also expose certain other functions. The following table shows the other functions that a block driver must expose.

Function Description
MyDriverEntry MyDriverEntry is a placeholder for the actual name of your DLL's entry point. After the Device Manager calls LoadLibrary to map the DLL, the system calls MyDriverEntry. For more information about the Device Manager, see Device Manager. This function performs any initialization tasks that are necessary for the block device driver. On successful return from MyDriverEntry, the Device Manager associates the driver's stream interface functions with a special device file name so that applications can access the device.

Block device drivers must respond to the I/O control codes shown in the following tables to interface properly with the FAT file system.

The following table shows the block device I/O control codes.

I/O control code Description
IOCTL_DISK_FORMAT_MEDIA Formats at a low level or reformats the block device.
IOCTL_DISK_GET_STORAGEID Retrieves the identifier associated with a storage device. These identifiers are device dependent.
IOCTL_DISK_GETINFO Retrieves information about the block device.
IOCTL_DISK_GETNAME Retrieves the name that the file system drivers should use as the block device's folder.
IOCTL_DISK_READ Reads data from the block device.
IOCTL_DISK_SETINFO Sets information about the block device.
IOCTL_DISK_WRITE Writes data to the block device.

See Also

Block Driver Architecture | Block Driver Samples | Block Driver Registry Settings | Block Driver Manager | Block Device File Systems | File System Loading and Unloading | Block Driver Loading | Block Driver Installation | Block Driver Detection | Block Driver Access | Block Driver Power Cycle

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.