Dennis
Wed Sep 22 09:11:13 CDT 2004
Hello Walter,
Thanks a lot for your advice.
I've studied your book quite a bit, and my implementation uses your
generic.sys (I built my own version with a different name).
Should I use your GenericCacheControlRequest function for this?
I need to re-study this section carefully.
Best Regards,
Dennis
"Walter Oney" <waltoney@oneysoft.com> wrote in message
news:41517E17.9C0B6A64@oneysoft.com...
> Dennis Burns wrote:
> > User mode code uses an overlapped call of DeviceIoControl to send an
IOCTL
> > to my driver. This operation normally takes quite a long time to
process. I
> > notice that DeviceIoControl is not returning immediately.
> > Do I need to mark the Irp as STATUS_PENDING in order for DeviceIoControl
to
> > return?
>
> Yes, but be sure to think exactly about this. You will call
> IoMarkIrpPending and return STATUS_PENDING from your dispatch routine.
> It's a mistake to set Irp->IoStatus.Status to STATUS_PENDING, which only
> has meaning as a return code from a dispatch routine.
>
> You should install a cancel routine for the IRP. You will have a
> difficult race condition between the cancel and completion paths, for
> which I suggest using the "pending IOCTL" support described in my book
> (and built into GENERIC.SYS).
>
> > Also, if I re-use the original Irp, and data is being passed back to the
> > User code, do I have to lock the buffer somehow?
>
> Not in a WDM driver. Buffer locking was required in 9x VxD drivers for
> asynchronous IOCTLs, but not for WDM drivers in any environment.
>
> --
> Walter Oney, Consulting and Training
> Basic and Advanced Driver Programming Seminars
> Check out our schedule at
http://www.oneysoft.com