Dispatch routine return values

Hello everyone,

I'm inquiring about the possible return values of dispatch routines and IoCallDriver in correctly implemented WDM drivers.

Are there any meaningful return values other than STATUS_SUCCESS and STATUS_PENDING?

From what I understand, the return value indicates the status of the dispatch routine's handling of the IRP, signifying whether it has been completed or is pending.

The final status of the IRP should always be set in Irp->IoStatus.Status. This is evidenced by the fact that in the completion routine, you can only determine if STATUS_PENDING was returned by checking Irp->PendingReturned. Being FALSE implies STATUS_SUCCESS.

Can you confirm if this understanding is correct and if there are other meaningful return values that should be considered?

Not quite. If your dispatch routine does not mark the IRP as pending, then it should return whatever value you put in Irp->IoStatus.Status, whether success or failure.


Common misunderstanding… but very incorrect.

You must return the status of the I/O operation. That is, as Mr Roberts said, the status with which you’ve completed the I/O request. I’d you don’t complete the request, you must mark the IRP pending and return STATUS_PENDING.

1 Like