Make sure that you call IoMarkIrpPending in the path that you pend the
IRP and that you return STATUS_PENDING when doing so. They must go hand
in hand, if you call IoMarkIrpPending you *must* return STATUS_PENDING.
Also, for IRPs that you didn’t create (ie received them in a dispatch
routine) that you are sending down the stack that you do the following
in the completion routine before allowing the irp to continue up the
stack.
if (Irp->PendingReturned) {
IoMarkIrpPending(Irp);
}
If you do this in your completion routine for IRPs you allocated
yourself, you will be corrupting memory with the IoMarkIrpPending call
(it touches memory in the current irp stack location which is
nonexistent).
Also, most importantly, enable the driver verifier on your driver(s).
It is usually very good at finding IRP pending bugs.
D
This posting is provided “AS IS” with no warranties, and confers no
rights
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Linda Marcellus
Sent: Wednesday, July 09, 2003 4:25 PM
To: NT Developers Interest List
Subject: [ntdev] Event not set after call to GetOverlappedResult
Hi,
I’ve written a driver for a usb device that (partially) emulates several
serial ports.
It works well with HyperTerminal and Terminal, but not with a custom
application that uses TurboPower’s ASyncPro com port components. I’ve
traced into the ASyncPro component to see that it calls WaitCommEvent
for
RXCHAR, CTS, DSR, RLSD, BREAK, ERR, and RING, and then calls
GetOverlappedResult to wait for the event.
My driver pends the IOCTL_SERIAL_WAIT_ON_MASK device control IRP, and
when
it receives data from the device at a later time, completes it, setting
the RXCHAR bit in the returned event word. However, I can see that at
the
completion of the application’s GetOverlappedResult the event mask
specified in the WaitCommEvent call is still 0.
The odd thing is that Terminal (I don’t have the source for it), also
uses
WaitCommEvent calls (since I see my driver handling
IOCTL_SERIAL_WAIT_ON_MASK). Terminal only waits on the RXCHAR event.
Also, I built TurboPower’s TermDemo sample program, and it accessed my
device with no problems, again using IOCTL_SERIAL_WAIT_ON_MASK.
I’m stumped as to how to proceed with debugging this problem. Any
suggestions would be greatly appreciated.
Thanks,
Linda
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com