I am writing a kmdf filter driver to intercept read requests. I really need some help getting to a point where I can get at the read buffer when I am filtering an asynchronous read request. I have looked at this (excellent) article http://www.osronline.com/article.cfm?id=83 and wanted to clarify that my understanding of what is going on here is correct.
In my read event I set a completion handler and pass the request down; my completion handler gets called. I can see from the file flags that the FO_SYNCHRONOUS_IO is not set; so we have an async read. I get the IRP (with WdfRequestWdmGetIrp()) in the completion routine and PendingReturned is true. So my “first stage completion” is happening and it’s pending, so no data yet. Humph - this doesn’t help me!
Is my understanding of what’s giong on here so far correct?
Do I have to pend the application’s read request, and issue or my own read to get the data or is there any way I can hook into the “second stage” APC completion?
I would very grateful for any hints, tips or pointers to WDK samples that illustrate how to do this!
Ignore FO_SYNCHRONOUS_IO - Windows makes all Io async, and handles synchronous reading clients for you.
In your completion routine use the completion parameters given to you in the arguments to get the completion status and number of bytes returned. And look in the request’s output buffer for the data being returned to the app.
-p
Sent from my Windows Phone
From: xxxxx@gmail.commailto:xxxxx
Sent: ?2/?24/?2015 2:45 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] kmdf filter - async reads; getting at the data?
I am writing a kmdf filter driver to intercept read requests. I really need some help getting to a point where I can get at the read buffer when I am filtering an asynchronous read request. I have looked at this (excellent) article http://www.osronline.com/article.cfm?id=83 and wanted to clarify that my understanding of what is going on here is correct.
In my read event I set a completion handler and pass the request down; my completion handler gets called. I can see from the file flags that the FO_SYNCHRONOUS_IO is not set; so we have an async read. I get the IRP (with WdfRequestWdmGetIrp()) in the completion routine and PendingReturned is true. So my “first stage completion” is happening and it’s pending, so no data yet. Humph - this doesn’t help me!
Is my understanding of what’s giong on here so far correct?
Do I have to pend the application’s read request, and issue or my own read to get the data or is there any way I can hook into the “second stage” APC completion?
I would very grateful for any hints, tips or pointers to WDK samples that illustrate how to do this!
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>