Some Dispatch Routines illustrate

  IRP_MJ_CLOSE indicates that the last handle of the file object that was associated the target device object has been closed and released. All I/O requests have been completed or canceled, so there are no outstanding references to the file object pointer.

   IRP_MJ_CLEANUP indicates that the last handle for a file object that is associated with the target device object is being closed. Outstanding I/O requests for the file object might still exist . Drivers can implement a DispatchCleanup routine to perform cleanup that is not specific to any particular file handle. Drivers can also use their DispatchClose routine for the same purpose.

 

  IRP_MJ_DEVICE_CONTROL indicates a request that contains a system-defined, device-type-specific I/O control code specifying a device type-specific operation. Higher-level drivers pass these IRPs on to their underlying device drivers, which typically process the request by accessing the device.

  IRP_MJ_INTERNAL_DEVICE_CONTROL indicates a request sent to the device driver, in most cases from a closely coupled higher-level driver, usually with a privately defined , driver-specific and device-type-specific or device-specific I/O control code requesting a device-type-specific or device-specific operation.

Only certain kinds of drivers are required to handle system-defined internal device I/O control requests, including certain SCSI drivers, keyboard or mouse device drivers, and parallel drivers that interoperate with system-supplied drivers.

 

  IRP_MJ_POWER indicates a request pertaining to the power state of either the device or the system. Such requests are sent to the device driver by either the power manager or a closely coupled higher-level driver.

 

  Any driver that is likely to be called before the system shuts down must handle IRP_MJ_SHUTDOWN. The DispatchShutdown routine should do whatever driver-determined cleanup is necessary before the power manager sends a system set-power IRP to shut down the system. A driver can call IoRegisterShutdownNotification or IoRegisterLastChanceShutdownNotification to register for showdown notification.

Drivers for mass-storage devices and intermediate drivers layered over them can rely on a highest-level 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 provide DispatchShutdown and DispatchFlushBuffers routines. If a mass-storage driver buffers data in memory but its device has no internal cache, it also must provide DispatchShutdown and DispatchFlushBuffers routines.

Any intermediate driver layered above a driver that handles IRP_MJ_FLUSH and IRP_MJ_SHUTDOWN requests also provide DispatchShutdown

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值