It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
Actually, since you must have a queue to process requests [exception follows], it would be more accurate to say the requests come to your code already pended, and the restriction is you can’t get them in unpended form unless you use a preprocess callback.
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
Ok, I see how that’s true. But say when a request first comes in, I
need to do some work. Then I need a separate thread to go and do some
work in another process context. The thread which called the dispatch
routine with the request needs to wait until the second thread is done
it’s work. How do I “re-pend” the WDFREQUEST? I tried putting it on a
secondary queue, but the problem there is you can’t remove a SPECIFIC
request from a queue. I’d rather not search the queue, retrieve each
request, compare handles against a handle I already have, and then
complete. From the documentation, I can’t complete a request I don’t
own, and I don’t have ownership when the request is in the secondary
queue.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bob Kjelgaard
Sent: Tuesday, February 06, 2007 3:12 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Pending a WDFREQUEST
Actually, since you must have a queue to process requests [exception
follows], it would be more accurate to say the requests come to your
code already pended, and the restriction is you can’t get them in
unpended form unless you use a preprocess callback.
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
Did you open the file handle as FILE_FLAG_OVERLAPPED? If not, it
doesn’t matter what you do in the driver, the i/o manager will force a
synchronous completion back to the calling thread
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
The request is already pending. Your current issue (judging from your other post) is whether you’ve actually completed it or not. A secondary one for the rest of the drivers running on your machine and ultimately your end users is how you intend to handle cancellation in this case. The request is not cancellable when you receive it for processing. Perhaps you mark it cancelable, and already properly handle cancellation, but I’d better mention it just in case, because it’s a difficult area in drivers that can produce terrible user experiences if handled incorrectly [like the hang you may be experiencing now?].
A queue is a handy place to store unprocessed requests [and it takes care of cancellation for you], but you can use other mechanisms (WDFCOLLECTION, for instance). I’ve written code to search a manual queue for a request I know is in there, and it may seem to be a pain [I thought it was, but I also can’t think of any way to make it better once I looked at all the issues involved], but handling cancellation if you don’t do this is an even bigger pain (particularly if you get it wrong and have already shipped your driver).
As far as the first issue goes, it sounds like the request was never completed. I’d recommend getting an IFR log (or using traceview/etc) of the driver, and looking at the history of a request. All of the events you are interested in (dispatch to you, call to WdfCompleteRequest, etc) are in there. If you are completing the request, and your app is still hung on that request, then something “interesting” [speaking as a tester] is at work here…
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:46 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Ok, I see how that’s true. But say when a request first comes in, I
need to do some work. Then I need a separate thread to go and do some
work in another process context. The thread which called the dispatch
routine with the request needs to wait until the second thread is done
it’s work. How do I “re-pend” the WDFREQUEST? I tried putting it on a
secondary queue, but the problem there is you can’t remove a SPECIFIC
request from a queue. I’d rather not search the queue, retrieve each
request, compare handles against a handle I already have, and then
complete. From the documentation, I can’t complete a request I don’t
own, and I don’t have ownership when the request is in the secondary
queue.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bob Kjelgaard
Sent: Tuesday, February 06, 2007 3:12 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Pending a WDFREQUEST
Actually, since you must have a queue to process requests [exception
follows], it would be more accurate to say the requests come to your
code already pended, and the restriction is you can’t get them in
unpended form unless you use a preprocess callback.
Yes, I did open it with FILE_FLAG_OVERLAPPED. I call DeviceIoControl
with an overlapped structure, and then
I do the following:
bResult = DeviceIoControl(…);
if( bResult == FALSE && GetLastError() != ERROR_IO_PENDING){
CloseHandle(overlapped.hEvent);
return false;
}
if(GetOverlappedResult(m_hDriver, &overlapped, pBytesReturned,
TRUE) == FALSE){
CloseHandle(overlapped.hEvent);
return false;
}
My thread hangs inside GetOverlappedResult(), even though I have called
WdfRequestComplete.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, February 06, 2007 3:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Did you open the file handle as FILE_FLAG_OVERLAPPED? If not, it
doesn’t matter what you do in the driver, the i/o manager will force a
synchronous completion back to the calling thread
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
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
Yes I understand the request is already pending. We had a semantic
issue there. I have tried to complete the request, but my user mode
thread never returns from GetOverlappedResult(). I have no need of
cancellation, the IO will never be cancelled, so that is not an issue.
I see the request come in, I do some work, I store the handle in a
structure and signal a secondary thread. The first (dispatch) thread
now exits the dispatch function. The secondary thread does more work in
a different process context, then calls WdfCompleteRequest on the stored
handle. To my understanding this should work fine, but my thread
calling GetOverlappedResult() never returns.
I tried using a secondary queue because the documentation hinted that
you can’t just store the handle to a request in your own structure. It
seems to say you must store the request in a queue or some other WDF
mechanism.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bob Kjelgaard
Sent: Tuesday, February 06, 2007 4:16 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
The request is already pending. Your current issue (judging from your
other post) is whether you’ve actually completed it or not. A secondary
one for the rest of the drivers running on your machine and ultimately
your end users is how you intend to handle cancellation in this case.
The request is not cancellable when you receive it for processing.
Perhaps you mark it cancelable, and already properly handle
cancellation, but I’d better mention it just in case, because it’s a
difficult area in drivers that can produce terrible user experiences if
handled incorrectly [like the hang you may be experiencing now?].
A queue is a handy place to store unprocessed requests [and it takes
care of cancellation for you], but you can use other mechanisms
(WDFCOLLECTION, for instance). I’ve written code to search a manual
queue for a request I know is in there, and it may seem to be a pain [I
thought it was, but I also can’t think of any way to make it better once
I looked at all the issues involved], but handling cancellation if you
don’t do this is an even bigger pain (particularly if you get it wrong
and have already shipped your driver).
As far as the first issue goes, it sounds like the request was never
completed. I’d recommend getting an IFR log (or using traceview/etc) of
the driver, and looking at the history of a request. All of the events
you are interested in (dispatch to you, call to WdfCompleteRequest, etc)
are in there. If you are completing the request, and your app is still
hung on that request, then something “interesting” [speaking as a
tester] is at work here…
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:46 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Ok, I see how that’s true. But say when a request first comes in, I
need to do some work. Then I need a separate thread to go and do some
work in another process context. The thread which called the dispatch
routine with the request needs to wait until the second thread is done
it’s work. How do I “re-pend” the WDFREQUEST? I tried putting it on a
secondary queue, but the problem there is you can’t remove a SPECIFIC
request from a queue. I’d rather not search the queue, retrieve each
request, compare handles against a handle I already have, and then
complete. From the documentation, I can’t complete a request I don’t
own, and I don’t have ownership when the request is in the secondary
queue.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bob Kjelgaard
Sent: Tuesday, February 06, 2007 3:12 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Pending a WDFREQUEST
Actually, since you must have a queue to process requests [exception
follows], it would be more accurate to say the requests come to your
code already pended, and the restriction is you can’t get them in
unpended form unless you use a preprocess callback.
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
Does your thread which called DeviceIoControl stay blocked in
DeviceIoControl even after you’ve completed the request?
If you’re doing overlapped I/O then I would expect the thread to return
from DeviceIoControl with an error of ERROR_IO_PENDING. Your app would
use this status to determine that it should wait for I/O completion
(usually on the event specified in the overlapped structure).
If you’re not doing overlapped I/O then your call to DeviceIoControl
won’t return until your driver completes the request. You need to
specify FILE_OPTIONS_OVERLAPPED (something like that) in your call to
CreateFile and you need to provide an OVERLAPPED structure when you
issue the request.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
Sorry, I miss-spoke, I meant it waits in GetOverlappedResult(). I am
doing overlapped I/O and I did open
with the FILE_FLAG_OVERLAPPED.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 4:46 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Does your thread which called DeviceIoControl stay blocked in
DeviceIoControl even after you’ve completed the request?
If you’re doing overlapped I/O then I would expect the thread to return
from DeviceIoControl with an error of ERROR_IO_PENDING. Your app would
use this status to determine that it should wait for I/O completion
(usually on the event specified in the overlapped structure).
If you’re not doing overlapped I/O then your call to DeviceIoControl
won’t return until your driver completes the request. You need to
specify FILE_OPTIONS_OVERLAPPED (something like that) in your call to
CreateFile and you need to provide an OVERLAPPED structure when you
issue the request.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
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
Where is it stuck in GetOverlappedResult? What does the callstack look
like? Is the hEvent handle in the non signaled state before the
DeviceIoControl call?
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 1:35 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Yes, I did open it with FILE_FLAG_OVERLAPPED. I call DeviceIoControl
with an overlapped structure, and then
I do the following:
bResult = DeviceIoControl(…);
if( bResult == FALSE && GetLastError() != ERROR_IO_PENDING){
CloseHandle(overlapped.hEvent);
return false;
}
if(GetOverlappedResult(m_hDriver, &overlapped, pBytesReturned,
TRUE) == FALSE){
CloseHandle(overlapped.hEvent);
return false;
}
My thread hangs inside GetOverlappedResult(), even though I have called
WdfRequestComplete.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, February 06, 2007 3:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Did you open the file handle as FILE_FLAG_OVERLAPPED? If not, it
doesn’t matter what you do in the driver, the i/o manager will force a
synchronous completion back to the calling thread
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
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
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
The issues with respect to storing a handle have as much to do with lifetimes and references as anything else. A framework created request handle is invalid after WdfCompleteRequest unless you have added a reference to it (and the original IRP of course is gone at that point, as well). We recommend using the framework [among other reasons] because it will clean up, and when you use something like a queue or WDFCOLLECTION, we handle the referencing for you. But we’ve stuck them other places [it’d be crazy not to do it in test drivers, because someone out there is going to, and you’d better try it first]. If you know what you’re doing, it’s safe.
Looking at the code you posted, I’m wondering
(a) did the original call to IoDeviceControl return TRUE? (But I don’t think that should matter in this case).
(b) Are you using a notification event or a synchronization (auto-reset) event? If the latter, might anyone else already have waited on it?
It also doesn’t hurt to get a trace and verify that what you think is happening in the framework really happened (i.e., that the request you completed is the one that came down, etc.). It’s sometimes easy to make unwarranted assumptions in debugging [at least, it always has been for me], and sometimes a check at least eliminates or reduces the possibility that you made one. Also, if this really is a bug somewhere, we’re probably going to ask you for one, anyway, to help reproduce the problem.
As an aside- your I/O WILL be cancelled if the app doing it crashes. Having ignored cancellation in the past (and also done it wrong a few times) I can tell you that among other things you get are machines that have to be power cycled because a crashed app won’t go away, and the system won’t restart until it does. If you are absolutely certain that your second thread ALWAYS completes each and every I/O in a timely fashion [unloads, removals, etc., all accounted for], there may not be an issue, but I have to admit it does leave me with a sense of concern. Cancellation matters.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@emc.com
Sent: Tuesday, February 06, 2007 1:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Yes I understand the request is already pending. We had a semantic
issue there. I have tried to complete the request, but my user mode
thread never returns from GetOverlappedResult(). I have no need of
cancellation, the IO will never be cancelled, so that is not an issue.
I see the request come in, I do some work, I store the handle in a
structure and signal a secondary thread. The first (dispatch) thread
now exits the dispatch function. The secondary thread does more work in
a different process context, then calls WdfCompleteRequest on the stored
handle. To my understanding this should work fine, but my thread
calling GetOverlappedResult() never returns.
I tried using a secondary queue because the documentation hinted that
you can’t just store the handle to a request in your own structure. It
seems to say you must store the request in a queue or some other WDF
mechanism.
-Jeff
Is it possible that bResult is coming back TRUE? According to the MSDN
documentation, GetOverlappedResult should be called for requests which
were pending.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 1:35 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Yes, I did open it with FILE_FLAG_OVERLAPPED. I call DeviceIoControl
with an overlapped structure, and then
I do the following:
bResult = DeviceIoControl(…);
if( bResult == FALSE && GetLastError() != ERROR_IO_PENDING){
CloseHandle(overlapped.hEvent);
return false;
}
if(GetOverlappedResult(m_hDriver, &overlapped, pBytesReturned,
TRUE) == FALSE){
CloseHandle(overlapped.hEvent);
return false;
}
My thread hangs inside GetOverlappedResult(), even though I have called
WdfRequestComplete.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, February 06, 2007 3:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Did you open the file handle as FILE_FLAG_OVERLAPPED? If not, it
doesn’t matter what you do in the driver, the i/o manager will force a
synchronous completion back to the calling thread
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
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
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
I figured it out, there was a bug in some old code that caused a
deadlock that didn’t show up for awhile. Thanks
for the help everyone.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bob Kjelgaard
Sent: Tuesday, February 06, 2007 5:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
The issues with respect to storing a handle have as much to do with
lifetimes and references as anything else. A framework created request
handle is invalid after WdfCompleteRequest unless you have added a
reference to it (and the original IRP of course is gone at that point,
as well). We recommend using the framework [among other reasons]
because it will clean up, and when you use something like a queue or
WDFCOLLECTION, we handle the referencing for you. But we’ve stuck them
other places [it’d be crazy not to do it in test drivers, because
someone out there is going to, and you’d better try it first]. If you
know what you’re doing, it’s safe.
Looking at the code you posted, I’m wondering
(a) did the original call to IoDeviceControl return TRUE? (But I don’t
think that should matter in this case).
(b) Are you using a notification event or a synchronization (auto-reset)
event? If the latter, might anyone else already have waited on it?
It also doesn’t hurt to get a trace and verify that what you think is
happening in the framework really happened (i.e., that the request you
completed is the one that came down, etc.). It’s sometimes easy to make
unwarranted assumptions in debugging [at least, it always has been for
me], and sometimes a check at least eliminates or reduces the
possibility that you made one. Also, if this really is a bug somewhere,
we’re probably going to ask you for one, anyway, to help reproduce the
problem.
As an aside- your I/O WILL be cancelled if the app doing it crashes.
Having ignored cancellation in the past (and also done it wrong a few
times) I can tell you that among other things you get are machines that
have to be power cycled because a crashed app won’t go away, and the
system won’t restart until it does. If you are absolutely certain that
your second thread ALWAYS completes each and every I/O in a timely
fashion [unloads, removals, etc., all accounted for], there may not be
an issue, but I have to admit it does leave me with a sense of concern.
Cancellation matters.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 1:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Yes I understand the request is already pending. We had a semantic
issue there. I have tried to complete the request, but my user mode
thread never returns from GetOverlappedResult(). I have no need of
cancellation, the IO will never be cancelled, so that is not an issue.
I see the request come in, I do some work, I store the handle in a
structure and signal a secondary thread. The first (dispatch) thread
now exits the dispatch function. The secondary thread does more work in
a different process context, then calls WdfCompleteRequest on the stored
handle. To my understanding this should work fine, but my thread
calling GetOverlappedResult() never returns.
I tried using a secondary queue because the documentation hinted that
you can’t just store the handle to a request in your own structure. It
seems to say you must store the request in a queue or some other WDF
mechanism.
-Jeff
—
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
As I understand bResult should NEVER be true in the case of KMDF
requests, since they are always marked pending.
Doron?
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 5:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Is it possible that bResult is coming back TRUE? According to the MSDN
documentation, GetOverlappedResult should be called for requests which
were pending.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 1:35 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Yes, I did open it with FILE_FLAG_OVERLAPPED. I call DeviceIoControl
with an overlapped structure, and then
I do the following:
bResult = DeviceIoControl(…);
if( bResult == FALSE && GetLastError() != ERROR_IO_PENDING){
CloseHandle(overlapped.hEvent);
return false;
}
if(GetOverlappedResult(m_hDriver, &overlapped, pBytesReturned,
TRUE) == FALSE){
CloseHandle(overlapped.hEvent);
return false;
}
My thread hangs inside GetOverlappedResult(), even though I have called
WdfRequestComplete.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, February 06, 2007 3:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Did you open the file handle as FILE_FLAG_OVERLAPPED? If not, it
doesn’t matter what you do in the driver, the i/o manager will force a
synchronous completion back to the calling thread
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
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
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
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
Unless there’s an upper filter driver that decides to synchronously wait
for your response.
It’s not a good idea to make assumptions in your app based on the fact
that you have a KMDF or UMDF driver.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 3:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
As I understand bResult should NEVER be true in the case of KMDF
requests, since they are always marked pending.
Doron?
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 5:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Is it possible that bResult is coming back TRUE? According to the MSDN
documentation, GetOverlappedResult should be called for requests which
were pending.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 1:35 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Yes, I did open it with FILE_FLAG_OVERLAPPED. I call DeviceIoControl
with an overlapped structure, and then
I do the following:
bResult = DeviceIoControl(…);
if( bResult == FALSE && GetLastError() != ERROR_IO_PENDING){
CloseHandle(overlapped.hEvent);
return false;
}
if(GetOverlappedResult(m_hDriver, &overlapped, pBytesReturned,
TRUE) == FALSE){
CloseHandle(overlapped.hEvent);
return false;
}
My thread hangs inside GetOverlappedResult(), even though I have called
WdfRequestComplete.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, February 06, 2007 3:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Did you open the file handle as FILE_FLAG_OVERLAPPED? If not, it
doesn’t matter what you do in the driver, the i/o manager will force a
synchronous completion back to the calling thread
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
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
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
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
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
It depends on how the internals of DeviceIoControl work. The I/O
manager already will handle the case where STATUS_PENDING is returned
and the IRP is completed synchronously by not going through the async
post completion path. What I don’t know if this reflects all the way
back up to the caller as a synchronous I/O or a async I/o that completed
immediately.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 3:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
As I understand bResult should NEVER be true in the case of KMDF
requests, since they are always marked pending.
Doron?
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 5:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Is it possible that bResult is coming back TRUE? According to the MSDN
documentation, GetOverlappedResult should be called for requests which
were pending.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 1:35 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Yes, I did open it with FILE_FLAG_OVERLAPPED. I call DeviceIoControl
with an overlapped structure, and then
I do the following:
bResult = DeviceIoControl(…);
if( bResult == FALSE && GetLastError() != ERROR_IO_PENDING){
CloseHandle(overlapped.hEvent);
return false;
}
if(GetOverlappedResult(m_hDriver, &overlapped, pBytesReturned,
TRUE) == FALSE){
CloseHandle(overlapped.hEvent);
return false;
}
My thread hangs inside GetOverlappedResult(), even though I have called
WdfRequestComplete.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, February 06, 2007 3:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Did you open the file handle as FILE_FLAG_OVERLAPPED? If not, it
doesn’t matter what you do in the driver, the i/o manager will force a
synchronous completion back to the calling thread
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 12:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Really… what should I do in my dispatch routine then? I tried doing
nothing (just letting the thread return from the routine), and then in a
secondary thread calling WfdRequestComplete, and my usermode thread
which called DeviceIoControl was still pending.
Perhaps I have something wrong in the DeviceIoControl call, but it works
as long as I complete the request in the context of the dispatch thread.
-Jeff
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, February 06, 2007 3:40 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Pending a WDFREQUEST
Putting it in a queue allows it to be cancelled automatically for you,
so that’s a good place to pend requests which you haven’t yet sent to
hardware. But the request is yours until you complete it or forward it
to another driver. So you can hold onto it however you want.
The framework takes care of returning STATUS_PENDING and marking the IRP
as pending for you.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@emc.com
Sent: Tuesday, February 06, 2007 11:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Pending a WDFREQUEST
It appears to me that the only way to pend a WDFREQUEST is to place it
on a WDFQUEUE. Is this true?
If so, isn’t that a little restrictive?
-Jeff
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
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
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
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
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
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
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