Kernel IRP

Hi all
I am making a disk filter driver, i am stuck in a problem. What i am doing is that i mark the kernel IRP PENDING and return the status STATUS_PENDING. then i dequeue the IRP and make own requests(breakup kernel IRP into multiple IRPs using partial MDL) on this behalf and the send my IRP down to the stack, when i get my IRP completion i call IOCOMPLETEREQUEST for the OS IRP.
PROBLEM:

It seems that whenever i try to copy a lengthy folder containing many files i get copying of folder stuck in the middle (destination Volume can not be accessed anymore) and i am completing all IRPs on my queue but kernel doen’t send anymore IRPs to us.

Anyone help me out this problem.

Most likely you are breaking one of the many rules on correctly
processing asynchronous requests. See this article:
http://www.microsoft.com/whdc/driver/kernel/IRPs.mspx

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.com
Sent: Wednesday, April 04, 2007 7:19 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Kernel IRP

Hi all
I am making a disk filter driver, i am stuck in a problem. What
i am doing is that i mark the kernel IRP PENDING and return the status
STATUS_PENDING. then i dequeue the IRP and make own requests(breakup
kernel IRP into multiple IRPs using partial MDL) on this behalf and the
send my IRP down to the stack, when i get my IRP completion i call
IOCOMPLETEREQUEST for the OS IRP.
PROBLEM:

It seems that whenever i try to copy a lengthy folder
containing many files i get copying of folder stuck in the middle
(destination Volume can not be accessed anymore) and i am completing all
IRPs on my queue but kernel doen’t send anymore IRPs to us.

Anyone help me out this problem.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> See this article: http://www.microsoft.com/whdc/driver/kernel/IRPs.mspx

…plus read discussions that Calvin Guan and myself had on both OSR forum and MSFT 'drivers" NG
about calling IoMarkIrpPending() in the completion routine - above mentioned doc, as well as DDK/WDK documentation, states that completion routine should always call IoMarkIrpPending() if Irp->PendingReturned field is TRUE…

If you read our discussion on 'drivers’NG you will be able to see a code snippet from IoCompleteRequest() implementation that proves that the above mentioned “rule” is, in actuality, just wrong - there is no need to call IoMarkIrpPending() from the completion routine whatsoever.
Furthermore, you will see the case when doing so is just a fatal mistake…

In other words, don’t take all MSFT- provided documents for an ultimate truth - they may be wrong from time to time…

Anton Bassov

Check the ReactOS code(open source). The kernel looks similar to Windows and
it is good reference for the implementation of many areas of Windows kernel.

Check the irp.c file , IofCompleteRequest() function for the IO completion.
I found it is very easy to understand than reading 100 page document.

~Sisimon

On 4/5/07, xxxxx@hotmail.com wrote:
>
> > See this article: http://www.microsoft.com/whdc/driver/kernel/IRPs.mspx
>
> …plus read discussions that Calvin Guan and myself had on both OSR
> forum and MSFT 'drivers" NG
> about calling IoMarkIrpPending() in the completion routine - above
> mentioned doc, as well as DDK/WDK documentation, states that completion
> routine should always call IoMarkIrpPending() if Irp->PendingReturned field
> is TRUE…
>
> If you read our discussion on 'drivers’NG you will be able to see a code
> snippet from IoCompleteRequest() implementation that proves that the above
> mentioned “rule” is, in actuality, just wrong - there is no need to call
> IoMarkIrpPending() from the completion routine whatsoever.
> Furthermore, you will see the case when doing so is just a fatal
> mistake…
>
> In other words, don’t take all MSFT- provided documents for an ultimate
> truth - they may be wrong from time to time…
>
> Anton Bassov
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


GCS d+ s: a- c++++ U> B+ L++>$ w++++$ W++(+++) PGP+N+ t PS+PE++ tv+(++) b+++
G+++ e++>(++++) h-- r
Don’t know this? See http://www.geekcode.com/geek.html

> Check the ReactOS code(open source).

…which is hardly an adequate reference, despite the fact that ReactOS is meant to be modelled upon Windows. If ReactOS takes this or that approach when implementing this or that feature,
it does not necessarily mean that Windows takes the same approach when implementing a given feature - even if a feature exposes itself to the client code exactly the same way on both OSes, there may still be some differences in its internal implementations on these OSes. Actually, the same applies to different versions of the same OS…

Anton Bassov