Re: DeviceIoControl, Overlapped vs Non-Overlapped: How it affects driver design?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Doron Holan [MS] (doronh_at_nospam.microsoft.com)
Date: 09/08/04


Date: Tue, 7 Sep 2004 21:53:22 -0700

this advice is a bit confusing. What Beverly meant to say is that if you
are going to mark the irp as pending, you must return STATUS_PENDING. You
may still call IoCompleteRequest from the dispatch routine, but if you had
previously marked the irp as pending, STATUS_PENDING must be returned. If
you have not marked the irp as pending, you can return the status that was
set in the PIRP.

d

-- 
Please do not send e-mail directly to this alias. this alias is for 
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Beverly Brown" <bbucetrap@hotmail.com> wrote in message 
news:u4ZU9mVlEHA.1152@TK2MSFTNGP11.phx.gbl...
> Actually, you do need to do something special in the driver. For 
> overlapped
> IOCTLs you need to queue the IRP, mark it as pending, set a cancel routine
> (you ahve to write a cancel routine to set) and return STATUS_PENDING from
> your dispatch routine. Do not call IoCompleteRequest from the dispatch
> routine. Instead you call it later after removing it from your queue.
>
> For non-overlapped you don't do any of the above. You call 
> IoCompleteRequest
> from your dispatch routine.
>
> Beverly
>
>
> "Don Burn" <burn@stopspam.acm.org> wrote in message 
> news:10jrlvos6k6ko11@corp.supernews.com...
>> The I/O manager takes care of this.  You should design your IOCTL code 
>> based
>> on what happens in the driver, i.e. requests that can be done quickly 
>> with
>> no long waits should just complete.  Requests that must wait for data or
>> other requests, should be marked pending and handled asynchronously.
>>
>>
>> -- 
>> Don Burn (MVP, Windows DDK)
>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>> Remove StopSpam from the email to reply
>>
>> "Dennis Burns" <dburns@rtessentials.com> wrote in message
>> news:ONttiBPlEHA.2504@TK2MSFTNGP14.phx.gbl...
>>> As a relative newbie at driver design, I'm struggling to get the "big
>>> picture". I'm still struggling with this issue, relating to how my 
>>> driver
>> is
>>> called.
>>>
>>> An IOCTL of my own creation may be called using the user-mode function
>>> DeviceIoControl, in either a synchronous (non-overlapped) or 
>>> asynchronous
>>> (overlapped) mode. Do I need to consider the calling mode when
>> implementing
>>> the driver? Or, will the IO Manager take care of the user-mode
>>> notification/completion details?
>>>
>>> Thanks in advance for the help,
>>> Dennis
>>>
>>>
>>
>>
>
> 


Relevant Pages

  • Re: About using IoCompleteRequest and iostatus blocks Status Field.
    ... You cannot pend most PNP IRP's you need to complete them, ... return STATUS_PENDING or complete the IRP with IoCompleteRequest. ... Your driver doesn't specifiy the resources, ... > IoStatus block's Status Field to STATUS_ PENDING (pending because I want ...
    (microsoft.public.development.device.drivers)
  • Re: Question about IoMarkIrpPending
    ... you are the owner of the irp and you have pended it. ... to propagate the pending status up the stack. ... and then are completing the irp in the dispatch routine. ... > The rule of calling IoMarkIrpPending has suffered me for a long time. ...
    (microsoft.public.development.device.drivers)
  • Re: IRP_MJ_READ asynchronous completion
    ... propagating the pending bit via IoMarkIrpPending in their completion ... , what does the IRP stack look like? ... Any idea what I do wrong or where I could have messed up my driver? ...
    (microsoft.public.development.device.drivers)
  • IRP never return? help!
    ... Inside the BulkUsb_CallUSBD,The status returned by IoCallDriver is IRP ... in dispatch routine: ... The client device driver passes USB request block structures ... Parameters.DeviceIoControl.IoControlCode field set to ...
    (microsoft.public.development.device.drivers)
  • Re: Filtering the IoStatus set by lower driver
    ... Either these two values must match, or the dispatch routine must mark the IRP as pending and return STATUS_PENDING. ... Presumably your dispatch routine just forwards the IRP to the lower driver and returns the result of IoCallDriver. ... Instead you'd need to mark the IRP as pending, then forward the request down, then return STATUS_PENDING and handle everything else in the completion routine. ...
    (microsoft.public.development.device.drivers)