Hi All,
We have TDI filter driver attached to tcpip.sys. In dispatch routine,
we are doing some processing before we pass this IRP to lower layer or complete IRP and for this we are maintaining our local queue marking IRP status as pending.
We observed that, sometimes driver above us cancels the IRP. But in our driver, we have added it in queue.
How one should respond to such IRP?s?
- Can we pass this IRP to lower layer driver?
- Do we need to complete the IRP as it is cancelled by upper filter?
- Do we need to set cancel routine?
Any pointers will be helpful.
Thanks,
Vaibhav
> 1. Can we pass this IRP to lower layer driver?
You can, but it is unwise.
Check the ->Cancel field before doing this, and, if it is set, complete the IRP as cancelled.
You can afford some races here, their cost is just sending the cancelled IRP down, which is unwise but is not a bug.
- Do we need to complete the IRP as it is cancelled by upper filter?
Yes.
- Do we need to set cancel routine?
The queue implementation should do this, if you want the IRP to be cancellable while on queue.
Note that you cannot afford the races in the queue implementation, including the cancel routine which is a part of it.
It is a good idea to use IoCsqXxx or KMDF queues, which will give you this implementation out-of-the box.
–
Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com