From: Gary G. Little on
If you REALLY want PNP and Po easy, and need not worry about W2K, or can
delay support for W2K for a while, use KMDF10.

The personal opinion of
Gary G. Little

"Calvin Guan" <hguan(a)nospam.broadcom.com> wrote in message
news:%23MO0NK$DGHA.2320(a)TK2MSFTNGP11.phx.gbl...
> "synchronously wait for it to come back" means:
>
> 1) setup a completion routine for the IRP (which will consume one stack
> location, so you can't use IoSkipCurrentIrpStackLocation, use IoCopyXxx
> instead), then you forward the request down by IoCallDriver.
>
> 2) Your main PNP path will wait on an event allocated from the kernel
> stack if the lower driver has not done with the IRP, for instance, it
> returned STATUS_PENDING.
>
> 3) The lower drivers has done with the IRP eventually, such as the bus
> driver has brought the device into a proper state for your device to
> start. The lower driver then completes the IRP and the I/O stack unwinding
> starts.
>
> 4) The I/O manage walks the i/o stack all the way back and calls
> completion routine installed at each stack location. Your completion
> routine gets call then. It will set the event which the main PNP path is
> waiting on, and return STATUS_MORE_PROCESSING_REQUIRED so that the stack
> unwinding (part of IRP completion process) will stop immediately. This
> prevents IRP and its associated resources from being deallocated because
> the rest of the PNP code path needs it.
>
> 5)Your main PNP path (IRP_MN_START_DEVICE) regains control and go ahead
> with whatever needs to be done to init your device.
>
> 6) After you are done with the START_DEVICE Irp, do NOT forget to complete
> it by calling IoCompleteRequest since the completion process has been
> paused by returning SMPR from your completion routine.
>
>
>
> If you want to learn how a PNP driver works by writing code from scratch,
> you should go over the DDK doc and/or get a good windows driver book such
> as Oney's at www.oneysoft.com
>
> If you just want to get your driver going quickly without messing with the
> nasty PNP/Po code, you can take the toaster sample from DDK.
>
> HTH, Calvin
>
> --
> Calvin Guan (Windows DDK MVP)
> NetXtreme Longhorn Miniport Prime
> Broadcom Corp. www.broadcom.com
>
> "kerby" <kerby(a)driftmark.com> wrote in message
> news:uHKbtEUDGHA.3984(a)TK2MSFTNGP14.phx.gbl...
>> Doron Holan [MS] wrote:
>>> you need to synchronously send the start irp down the stack, you have
>>>
>>>
>>>>NTSTATUS status = IoCallDriver(pdx->LowerDeviceObject, Irp);
>>>>
>>>>// then pass down this Minor Function for the next driver stack:
>>>>IoSkipCurrentIrpStackLocation(Irp);
>>>
>>>
>>> you are touching an irp after it left your driver in the call to
>>> IoSkipCurrentStackLocation after calling IoCallDriver. instead, send
>>> the irp and synchronously wait for it to come back. there are many
>>> examples in the DDK which show this.
>>>
>>> d
>>
>> one question, is there somehing in my code before that should be removed?
>>
>> anyway, is what you're saying
>> something like this:
>> NTSTATUS PassDownPnP( IN PDEVICE_OBJECT pDO,
>> IN PIRP pIrp ) {
>> IoSkipCurrentIrpStackLocation( pIrp );
>> PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)
>> pDO->DeviceExtension;
>> return IoCallDriver(pDevExt->pLowerDevice, pIrp);
>> }
>>
>> ?
>> -krby_xtrm-
>
>