Handling IRPs 9: Summary of Guidelines for Pending IRPs

来源:互联网 发布:金蝶软件连接数据库 编辑:程序博客网 时间:2024/06/08 03:01

smmary of Guidelines for Pending IRPs

Driver writers must follow certain guidelines when handling IRPs for which STATUS_PENDING can be returned. Ignoring these guidelines may cause post-processing to occur twice, resulting in a system crash, or prevent post-processing from occurring, resulting in a system hang.

The following are the fundamental guidelines for returning STATUS_PENDING:

·         If a driver returns STATUS_PENDING, it must first call the IoMarkIrpPending macro to mark the I/O stack location aspending.

·         Conversely, if a driver calls IoMarkIrpPending, it must return STATUS_PENDING.

 

In addition:

·         If a driver returns the same status as the next lower driver and sets an IoCompletion routine, theIoCompletion routine must call IoMarkIrpPending if the value of theIrp->PendingReturned field is TRUE.

If a driver completes an I/O request on a different thread from that on which it received the request, its dispatch routine orIoCompletion routine must call IoMarkIrpPending and its dispatch routine must return STATUS_PENDING.
原创粉丝点击