Hi, all
in a Win2k filter driver layered above serenum/serial, I have the
following
need:
when a Create (Open) Irp is received by my filter, I have to let the
lower
drivers handle it and, if the operation is successful, I have to send
some
IOCtls to the serial driver *before* any other operation is performed by
the application that opened the serial port.
I can’t send IOCtls to the serial port I’m filtering before it is open,
so
I’ve tried the following approach:
- I set a completion routine for the Create IRP
- in my completion routine, I check if the open was successful and, if
so,
i save the Create Irp address, start a worker thread and return
STATUS_MORE_PROCESSING_REQUIRED (without pending the Irp); according
to
the docs, this should stop the completion chain for the Irp until
someone
calls again IoCompleteIrp for it - in the worker thread, I send the IOCtls needed for my filter
initializa-
tion, then I complete the Create Irp previously saved by calling
IoCompleteIrp
Testing it, I see that after the worker thread completes the Create Irp,
an
access violation occurs with the same Irp used for an IOCtl from the
application that opened the serial Port (the Irp seems corrupt: the
CurrentStackPosition pointer is zero)
I’ve also noticed that when my worker thread completes the Create Irp,
the
values of some fields in it are different from when I return
STATUS_MORE_PROCESSING_REQUIRED to delay the completion. It seems that
the
Irp is modified (reused??) in the interval between the completion
routine
returning STATUS_MORE_PROCESSING_REQUIRED and the worker thread
effectively
completing it, whilst I assumed from the docs that the driver returning
STATUS_MORE_PROCESSING_REQUIRED retained the Irp ownership until the Irp
was effectively completed.
Did I misinterpret the docs, or anyway miss something, or can someone
suggest an alternate approach?
Thank you in advance
Carlo Andreoli