6.1.2 Conditionally Implemented Dispatch Routines

Other requests that NT device and intermediate drivers might handle include the following:

NT drivers for mass-storage devices and intermediate drivers layered over them can rely on a highest-level NT file system driver to send them shutdown IRPs when the system is about to shut down. That is, the FSD is responsible for making sure that any cached file data is written out to peripheral devices, calling underlying drivers to flush data from their device caches or buffers (if any), and so forth before the system is shut down.

The driver of a mass-storage device that caches data internally must set the entry points in the driver object for its DispatchShutdown and DispatchFlush routines when it initializes. If such a driver buffers data in memory but its device has no internal cache, it also must set DispatchShutdown and DispatchFlush entry points in its driver object when it initializes.

Any intermediate driver layered above a driver that handles IRP_MJ_FLUSH and IRP_MJ_SHUTDOWN requests also must set its DispatchShutdown and DispatchFlush entry points in its driver object when it initializes.