Hello,
I’am writing a WDM driver for Windows 2000 to interface a custom PCI card
and I have 2 questions:
-
Is there any way two do simultaneously a ReadFile and a WriteFile
without opening two handles (CreateFile). The IO manager seems to queue
(the dispatch routines in the driver are not called) the write/write
operation while previous read/write operation is not terminated. In my
driver, the read and the write must be blocking and a read must be
absolutely executed at the same time as the write operation.
-
My big problem: when I want to quit my application, I call CloseHandle
on both my handle but again the IO manager seems to block my request. The
Cleanup dispatch routine and the CloseHandle dispatch routine are not
called. It is only when the read or the write terminates that the
dispatchers are called. But I understand well, it is the goal of the
cleanup routine to terminated the pending IRP. How can I do this is my
dispatcher is never called ?
Note: My DispatchReadWrite routine call IoMarkIrpPending() and return
STATUS_PENDING. I do not use the start IO. I have my own queue (one for the
read and one for the write operations). The processing is done in a ISR and
the IRP are terminated in a DpcForIsr.
Thanks for you help !!
Yves
-
In my opinion, the simplest way to get pending reads and writes with
the same handle is to either have your application open two threads (they
can share the handle) or open your device overlapped, create two overlapped
structures, and issue two reads one right after the other and then wait for
completion on both of them.
-
While there is pending I/O the DispatchClose routine will not be
called. Are you setting up your cancel routines for the IRPs? Also, you
can call CancelIO from user mode, but then the handle must have been opened
for overlapped operation.
Shaun
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Yves Godin
Sent: Wednesday, October 30, 2002 8:23 PM
To: NT Developers Interest List
Subject: [ntdev] Deadlock with CloseHandle
Hello,
I’am writing a WDM driver for Windows 2000 to interface a custom PCI card
and I have 2 questions:
-
Is there any way two do simultaneously a ReadFile and a WriteFile
without opening two handles (CreateFile). The IO manager seems to queue
(the dispatch routines in the driver are not called) the write/write
operation while previous read/write operation is not terminated. In my
driver, the read and the write must be blocking and a read must be
absolutely executed at the same time as the write operation.
-
My big problem: when I want to quit my application, I call CloseHandle
on both my handle but again the IO manager seems to block my request. The
Cleanup dispatch routine and the CloseHandle dispatch routine are not
called. It is only when the read or the write terminates that the
dispatchers are called. But I understand well, it is the goal of the
cleanup routine to terminated the pending IRP. How can I do this is my
dispatcher is never called ?
Note: My DispatchReadWrite routine call IoMarkIrpPending() and return
STATUS_PENDING. I do not use the start IO. I have my own queue (one for the
read and one for the write operations). The processing is done in a ISR and
the IRP are terminated in a DpcForIsr.
Thanks for you help !!
Yves
You are currently subscribed to ntdev as: xxxxx@tenpennies.com
To unsubscribe send a blank email to %%email.unsub%%
I/O acquires the file-object lock when you do synchronous i/o on
reads/writes/cleanup etc., and releases it only when it completes so
this is working exactly as designed. This has nothing to do with drivers
returning pending or otherwise -
If the app opened the handle for ‘overlapped i/o’, I/O would not
synchronize i/o to that file object.
Ravi
-----Original Message-----
From: Yves Godin [mailto:xxxxx@lyre.qc.ca]
Sent: Wednesday, October 30, 2002 8:23 PM
To: NT Developers Interest List
Subject: [ntdev] Deadlock with CloseHandle
Hello,
I’am writing a WDM driver for Windows 2000 to interface a custom
PCI card and I have 2 questions:
-
Is there any way two do simultaneously a ReadFile and a WriteFile
without opening two handles (CreateFile). The IO manager seems to queue
(the dispatch routines in the driver are not called) the write/write
operation while previous read/write operation is not terminated. In my
driver, the read and the write must be blocking and a read must be
absolutely executed at the same time as the write operation.
-
My big problem: when I want to quit my application, I call
CloseHandle on both my handle but again the IO manager seems to block my
request. The Cleanup dispatch routine and the CloseHandle dispatch
routine are not called. It is only when the read or the write terminates
that the dispatchers are called. But I understand well, it is the goal
of the cleanup routine to terminated the pending IRP. How can I do this
is my dispatcher is never called ?
Note: My DispatchReadWrite routine call IoMarkIrpPending() and return
STATUS_PENDING. I do not use the start IO. I have my own queue (one for
the read and one for the write operations). The processing is done in a
ISR and the IRP are terminated in a DpcForIsr.
Thanks for you help !!
Yves
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%
> 1. Is there any way two do simultaneously a ReadFile and a WriteFile
without opening two handles (CreateFile). The IO manager seems to
queue
(the dispatch routines in the driver are not called) the write/write
operation while previous read/write operation is not terminated. In
my
Use overlapped IO to get rid of this.
Max
if you want multiple IO requests on a file handle you need to open it
for overlapped operations. This means you’ll need to provide an
overlapped structure with each request which contains the offset for the
operation - the IO system no longer the current file position for you in
this case.
if you want to be able to close the handle while IO is outstanding you
need to support cancellation. Once your outstanding IO is cancelled the
cleanup and close requests will be sent.
-p
-----Original Message-----
From: Yves Godin [mailto:xxxxx@lyre.qc.ca]
Sent: Wednesday, October 30, 2002 8:23 PM
To: NT Developers Interest List
Subject: [ntdev] Deadlock with CloseHandle
Hello,
I’am writing a WDM driver for Windows 2000 to interface a custom
PCI card and I have 2 questions:
-
Is there any way two do simultaneously a ReadFile and a WriteFile
without opening two handles (CreateFile). The IO manager seems to queue
(the dispatch routines in the driver are not called) the write/write
operation while previous read/write operation is not terminated. In my
driver, the read and the write must be blocking and a read must be
absolutely executed at the same time as the write operation.
-
My big problem: when I want to quit my application, I call
CloseHandle on both my handle but again the IO manager seems to block my
request. The Cleanup dispatch routine and the CloseHandle dispatch
routine are not called. It is only when the read or the write terminates
that the dispatchers are called. But I understand well, it is the goal
of the cleanup routine to terminated the pending IRP. How can I do this
is my dispatcher is never called ?
Note: My DispatchReadWrite routine call IoMarkIrpPending() and return
STATUS_PENDING. I do not use the start IO. I have my own queue (one for
the read and one for the write operations). The processing is done in a
ISR and the IRP are terminated in a DpcForIsr.
Thanks for you help !!
Yves
You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%