Hi, ALL!

I got the following problem with my USB driver running on Windows XP
SP2. Everything works fine, sleep, wake-up, hot-unplug, regular unplug,
data transfers and so on, except when I try to shutdown the system with
my device plugged in and, consequently, my driver loaded. System gets
all the way through shutdown procedure, saves all unsaved data, blanks
the screen and then turns it on back and displays the message from
Driver Verifier "IO SYSTEM VERIFICATION ERROR (WDM DRIVER ERROR 226)".
I never saw any problem during regular shutdown without Driver Verifier
activated. I double-checked all my handlers - none of them leaves IRP
uncompleted or not passed down the stack.

With best regards,
Vladimir S. Mirgorodsky

Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by Calvin

Calvin
Wed Jul 06 11:53:27 CDT 2005

Can you post the output of !analyze -v? DV won't dream up such an idea,
there must be something wrong in your code. I suggest enabling DV as eariler
as you can load your driver before any feature is added to the driver.


--
Calvin Guan (Windows DDK MVP)
Staff SW Engineer NetXtreme MINIPORT
Broadcom Corp. Irvine, CA
www.broadcom.com

<v_mirgorodsky@yahoo.com> wrote in message
news:1120651110.428810.90340@g44g2000cwa.googlegroups.com...
> Hi, ALL!
>
> I got the following problem with my USB driver running on Windows XP
> SP2. Everything works fine, sleep, wake-up, hot-unplug, regular unplug,
> data transfers and so on, except when I try to shutdown the system with
> my device plugged in and, consequently, my driver loaded. System gets
> all the way through shutdown procedure, saves all unsaved data, blanks
> the screen and then turns it on back and displays the message from
> Driver Verifier "IO SYSTEM VERIFICATION ERROR (WDM DRIVER ERROR 226)".
> I never saw any problem during regular shutdown without Driver Verifier
> activated. I double-checked all my handlers - none of them leaves IRP
> uncompleted or not passed down the stack.
>
> With best regards,
> Vladimir S. Mirgorodsky
>



Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by v_mirgorodsky

v_mirgorodsky
Thu Jul 07 07:30:44 CDT 2005

I found that it is a problem in PowerHandler(), at least DV claims
that. I will share results of my investigation as soon as I get the
problem solved.

With best regards,
Vladimir S. Mirgorodsky


Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by v_mirgorodsky

v_mirgorodsky
Thu Jul 07 10:36:14 CDT 2005

My power handler was installing completion routine on the system power
IRP and was passing it down the stack. As usual, I returned from my
power handler the value, returned by PoCallDriver() call. The system
was accepting such behavior without any complains, but Driver Verifier
decided that the power IRP was not completed appropriately and asserted
with the system IRP. I cure the problem by returning STATUS_PENDING
whenever I install completion routine on either device power IRP or
system power IRP. Now DV does not have any objections to my code.

I think this is a bug in Driver Verifier, since I always suppose to
return the same status as returned by IoCallDriver() or PoCallDriver()
from my dispatch routines. Please, correct me if I am wrong about this
issue.

With best regards,
Vladimir S. Mirgorodsky


Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by Calvin

Calvin
Thu Jul 07 11:31:19 CDT 2005

> but Driver Verifier decided that the power IRP was not
> completed appropriately and asserted with the system IRP.

What exactly is the bugcheck code and parameters? What status does lower
return?

--
Calvin Guan (Windows DDK MVP)
Staff SW Engineer NetXtreme MINIPORT
Broadcom Corp. Irvine, CA
www.broadcom.com



Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by v_mirgorodsky

v_mirgorodsky
Thu Jul 07 13:01:40 CDT 2005

I have the following code:

NTSTATUS DispatchPower()
{
...
IoMarkIrpPending(Irp);
status = IoSetCompletionRoutine(Irp, ...);
status = PoCallDriver(pdx->LowerDeviceObject, Irp);
// Return the same status as PoCallDriver() returned
return status;
}

NTSTATUS PowCompletionRoutine(PDEVICE_OBJECT junk, PIRP Irp, ...)
{
...
Irp->IoStatus.Status = ctx->status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}

With DV enabled I see the blue screen with two lines of text:
IO SYSTEM VERIFICATION ERROR (WDM DRIVER ERROR 226)
SMX-I15x.sys+1A50, F125E400

The 1A50 offset is the start of DispatchPower() handler, I suppose,
F125E400 is the IRP DV treated as uncompleted. As soon as I change my
power handler to do the following the problem disapeared.

NTSTATUS DispatchPower()
{
...
IoMarkIrpPending(Irp);
status = IoSetCompletionRoutine(Irp, ...);
status = PoCallDriver(pdx->LowerDeviceObject, Irp);
return STATUS_PENDING;
}

I have a feeling, that this is wrong, since without DV enabled, whole
system works fine with the first edition of code.

With best regards,
Vladimir S. Mirgorodsky

Calvin Guan wrote:
> > but Driver Verifier decided that the power IRP was not
> > completed appropriately and asserted with the system IRP.
>
> What exactly is the bugcheck code and parameters? What status does lower
> return?
>
> --
> Calvin Guan (Windows DDK MVP)
> Staff SW Engineer NetXtreme MINIPORT
> Broadcom Corp. Irvine, CA
> www.broadcom.com


Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by Maxim

Maxim
Thu Jul 07 13:09:01 CDT 2005

Forgettting to call PoStartNextPowerIrp is one of the possible cases.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

<v_mirgorodsky@yahoo.com> wrote in message
news:1120750574.229189.59190@g14g2000cwa.googlegroups.com...
> My power handler was installing completion routine on the system power
> IRP and was passing it down the stack. As usual, I returned from my
> power handler the value, returned by PoCallDriver() call. The system
> was accepting such behavior without any complains, but Driver Verifier
> decided that the power IRP was not completed appropriately and asserted
> with the system IRP. I cure the problem by returning STATUS_PENDING
> whenever I install completion routine on either device power IRP or
> system power IRP. Now DV does not have any objections to my code.
>
> I think this is a bug in Driver Verifier, since I always suppose to
> return the same status as returned by IoCallDriver() or PoCallDriver()
> from my dispatch routines. Please, correct me if I am wrong about this
> issue.
>
> With best regards,
> Vladimir S. Mirgorodsky
>



Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by v_mirgorodsky

v_mirgorodsky
Thu Jul 07 13:33:23 CDT 2005

I have a PoStartNextPowerIrp() call in my code. I just forget to put
it into code snipet.


Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by Doron

Doron
Fri Jul 08 09:33:02 CDT 2005

you need to call IoCopyCurrentIrpStackLocationToNext before calling
PoCallDriver. completion routines are per stack location. this only works
b/c the next stack location was not setting its own completion routine.

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.


<v_mirgorodsky@yahoo.com> wrote in message
news:1120759300.355260.191550@z14g2000cwz.googlegroups.com...
>I have the following code:
>
> NTSTATUS DispatchPower()
> {
> ...
> IoMarkIrpPending(Irp);
> status = IoSetCompletionRoutine(Irp, ...);
> status = PoCallDriver(pdx->LowerDeviceObject, Irp);
> // Return the same status as PoCallDriver() returned
> return status;
> }
>
> NTSTATUS PowCompletionRoutine(PDEVICE_OBJECT junk, PIRP Irp, ...)
> {
> ...
> Irp->IoStatus.Status = ctx->status;
> IoCompleteRequest(Irp, IO_NO_INCREMENT);
> return STATUS_SUCCESS;
> }
>
> With DV enabled I see the blue screen with two lines of text:
> IO SYSTEM VERIFICATION ERROR (WDM DRIVER ERROR 226)
> SMX-I15x.sys+1A50, F125E400
>
> The 1A50 offset is the start of DispatchPower() handler, I suppose,
> F125E400 is the IRP DV treated as uncompleted. As soon as I change my
> power handler to do the following the problem disapeared.
>
> NTSTATUS DispatchPower()
> {
> ...
> IoMarkIrpPending(Irp);
> status = IoSetCompletionRoutine(Irp, ...);
> status = PoCallDriver(pdx->LowerDeviceObject, Irp);
> return STATUS_PENDING;
> }
>
> I have a feeling, that this is wrong, since without DV enabled, whole
> system works fine with the first edition of code.
>
> With best regards,
> Vladimir S. Mirgorodsky
>
> Calvin Guan wrote:
>> > but Driver Verifier decided that the power IRP was not
>> > completed appropriately and asserted with the system IRP.
>>
>> What exactly is the bugcheck code and parameters? What status does lower
>> return?
>>
>> --
>> Calvin Guan (Windows DDK MVP)
>> Staff SW Engineer NetXtreme MINIPORT
>> Broadcom Corp. Irvine, CA
>> www.broadcom.com
>



Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by v_mirgorodsky

v_mirgorodsky
Fri Jul 08 13:27:19 CDT 2005

Hello Doron,

Sure, I have a IoCopyCurrentIrpStackLocationToNext() call in my code. I
did not included it in the code snippet to make things simple. The
issue I mentioned in the beginning is resolved. The only question is
this: can I return the value returned to me by IoCallDriver() or
PoCallDriver() as my dispatch routine return code when I install the
completion routine and send IRP down the stack? In my case DV was
complaining as IRP is not completed, unless I return status pending
from my dispatch routine.

With best regards,
Vladimir S. Mirgorodsky


Doron Holan [MS] wrote:
> you need to call IoCopyCurrentIrpStackLocationToNext before calling
> PoCallDriver. completion routines are per stack location. this only works
> b/c the next stack location was not setting its own completion routine.
>
> 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.
>
>
> <v_mirgorodsky@yahoo.com> wrote in message
> news:1120759300.355260.191550@z14g2000cwz.googlegroups.com...
> >I have the following code:
> >
> > NTSTATUS DispatchPower()
> > {
> > ...
> > IoMarkIrpPending(Irp);
> > status = IoSetCompletionRoutine(Irp, ...);
> > status = PoCallDriver(pdx->LowerDeviceObject, Irp);
> > // Return the same status as PoCallDriver() returned
> > return status;
> > }
> >
> > NTSTATUS PowCompletionRoutine(PDEVICE_OBJECT junk, PIRP Irp, ...)
> > {
> > ...
> > Irp->IoStatus.Status = ctx->status;
> > IoCompleteRequest(Irp, IO_NO_INCREMENT);
> > return STATUS_SUCCESS;
> > }
> >
> > With DV enabled I see the blue screen with two lines of text:
> > IO SYSTEM VERIFICATION ERROR (WDM DRIVER ERROR 226)
> > SMX-I15x.sys+1A50, F125E400
> >
> > The 1A50 offset is the start of DispatchPower() handler, I suppose,
> > F125E400 is the IRP DV treated as uncompleted. As soon as I change my
> > power handler to do the following the problem disapeared.
> >
> > NTSTATUS DispatchPower()
> > {
> > ...
> > IoMarkIrpPending(Irp);
> > status = IoSetCompletionRoutine(Irp, ...);
> > status = PoCallDriver(pdx->LowerDeviceObject, Irp);
> > return STATUS_PENDING;
> > }
> >
> > I have a feeling, that this is wrong, since without DV enabled, whole
> > system works fine with the first edition of code.
> >
> > With best regards,
> > Vladimir S. Mirgorodsky
> >
> > Calvin Guan wrote:
> >> > but Driver Verifier decided that the power IRP was not
> >> > completed appropriately and asserted with the system IRP.
> >>
> >> What exactly is the bugcheck code and parameters? What status does lower
> >> return?
> >>
> >> --
> >> Calvin Guan (Windows DDK MVP)
> >> Staff SW Engineer NetXtreme MINIPORT
> >> Broadcom Corp. Irvine, CA
> >> www.broadcom.com
> >


Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by Calvin

Calvin
Fri Jul 08 13:18:50 CDT 2005

You marked Irp pending and you must return STATUS_PENDING regardless what
lower has returned. If this wasn't an power irp (such as IOCTL/RD/WR), you
will get an MULTIPLE_IRP_COMPLETE_REQUESTS bugcheck if the lower returned
anything other than STATUS_PENDING.

If you don't want to blindly return STATUS_PENDING, you need to
conditionally propagate the pending flags in you completion routine instead
of marking it pending in the dispatch routine.

--
Calvin Guan (Windows DDK MVP)
Staff SW Engineer NetXtreme MINIPORT
Broadcom Corp. Irvine, CA
www.broadcom.com

<v_mirgorodsky@yahoo.com> wrote in message
news:1120759300.355260.191550@z14g2000cwz.googlegroups.com...
>I have the following code:
>
> NTSTATUS DispatchPower()
> {
> ...
> IoMarkIrpPending(Irp);
> status = IoSetCompletionRoutine(Irp, ...);
> status = PoCallDriver(pdx->LowerDeviceObject, Irp);
> // Return the same status as PoCallDriver() returned
> return status;
> }
>
> NTSTATUS PowCompletionRoutine(PDEVICE_OBJECT junk, PIRP Irp, ...)
> {
> ...
> Irp->IoStatus.Status = ctx->status;
> IoCompleteRequest(Irp, IO_NO_INCREMENT);
> return STATUS_SUCCESS;
> }
>
> With DV enabled I see the blue screen with two lines of text:
> IO SYSTEM VERIFICATION ERROR (WDM DRIVER ERROR 226)
> SMX-I15x.sys+1A50, F125E400
>
> The 1A50 offset is the start of DispatchPower() handler, I suppose,
> F125E400 is the IRP DV treated as uncompleted. As soon as I change my
> power handler to do the following the problem disapeared.
>
> NTSTATUS DispatchPower()
> {
> ...
> IoMarkIrpPending(Irp);
> status = IoSetCompletionRoutine(Irp, ...);
> status = PoCallDriver(pdx->LowerDeviceObject, Irp);
> return STATUS_PENDING;
> }
>
> I have a feeling, that this is wrong, since without DV enabled, whole
> system works fine with the first edition of code.
>
> With best regards,
> Vladimir S. Mirgorodsky
>
> Calvin Guan wrote:
>> > but Driver Verifier decided that the power IRP was not
>> > completed appropriately and asserted with the system IRP.
>>
>> What exactly is the bugcheck code and parameters? What status does lower
>> return?
>>
>> --
>> Calvin Guan (Windows DDK MVP)
>> Staff SW Engineer NetXtreme MINIPORT
>> Broadcom Corp. Irvine, CA
>> www.broadcom.com
>



Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by Doron

Doron
Sat Jul 09 11:14:13 CDT 2005

you need to propagate the pending status of the irp. in your completion
routine

if (Irp->PendingReturned) {
IoMarkIrpPending(Irp);
}
...

you should NOT mark the irp as pending in your dispatch routine. if you do
so, you must return STATUS_PENDING. if you are going to pend the irp when
it is going up the stack, you should mark it pending in the completion
routine.

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.


<v_mirgorodsky@yahoo.com> wrote in message
news:1120847239.190682.51500@g14g2000cwa.googlegroups.com...
> Hello Doron,
>
> Sure, I have a IoCopyCurrentIrpStackLocationToNext() call in my code. I
> did not included it in the code snippet to make things simple. The
> issue I mentioned in the beginning is resolved. The only question is
> this: can I return the value returned to me by IoCallDriver() or
> PoCallDriver() as my dispatch routine return code when I install the
> completion routine and send IRP down the stack? In my case DV was
> complaining as IRP is not completed, unless I return status pending
> from my dispatch routine.
>
> With best regards,
> Vladimir S. Mirgorodsky
>
>
> Doron Holan [MS] wrote:
>> you need to call IoCopyCurrentIrpStackLocationToNext before calling
>> PoCallDriver. completion routines are per stack location. this only
>> works
>> b/c the next stack location was not setting its own completion routine.
>>
>> 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.
>>
>>
>> <v_mirgorodsky@yahoo.com> wrote in message
>> news:1120759300.355260.191550@z14g2000cwz.googlegroups.com...
>> >I have the following code:
>> >
>> > NTSTATUS DispatchPower()
>> > {
>> > ...
>> > IoMarkIrpPending(Irp);
>> > status = IoSetCompletionRoutine(Irp, ...);
>> > status = PoCallDriver(pdx->LowerDeviceObject, Irp);
>> > // Return the same status as PoCallDriver() returned
>> > return status;
>> > }
>> >
>> > NTSTATUS PowCompletionRoutine(PDEVICE_OBJECT junk, PIRP Irp, ...)
>> > {
>> > ...
>> > Irp->IoStatus.Status = ctx->status;
>> > IoCompleteRequest(Irp, IO_NO_INCREMENT);
>> > return STATUS_SUCCESS;
>> > }
>> >
>> > With DV enabled I see the blue screen with two lines of text:
>> > IO SYSTEM VERIFICATION ERROR (WDM DRIVER ERROR 226)
>> > SMX-I15x.sys+1A50, F125E400
>> >
>> > The 1A50 offset is the start of DispatchPower() handler, I suppose,
>> > F125E400 is the IRP DV treated as uncompleted. As soon as I change my
>> > power handler to do the following the problem disapeared.
>> >
>> > NTSTATUS DispatchPower()
>> > {
>> > ...
>> > IoMarkIrpPending(Irp);
>> > status = IoSetCompletionRoutine(Irp, ...);
>> > status = PoCallDriver(pdx->LowerDeviceObject, Irp);
>> > return STATUS_PENDING;
>> > }
>> >
>> > I have a feeling, that this is wrong, since without DV enabled, whole
>> > system works fine with the first edition of code.
>> >
>> > With best regards,
>> > Vladimir S. Mirgorodsky
>> >
>> > Calvin Guan wrote:
>> >> > but Driver Verifier decided that the power IRP was not
>> >> > completed appropriately and asserted with the system IRP.
>> >>
>> >> What exactly is the bugcheck code and parameters? What status does
>> >> lower
>> >> return?
>> >>
>> >> --
>> >> Calvin Guan (Windows DDK MVP)
>> >> Staff SW Engineer NetXtreme MINIPORT
>> >> Broadcom Corp. Irvine, CA
>> >> www.broadcom.com
>> >
>



Re: Driver verifier IO SYSTEM VERIFICATION ERROR 226 by v_mirgorodsky

v_mirgorodsky
Mon Jul 11 14:26:15 CDT 2005

Okay, now I see where is my problem resides. Thanks for all the
responces :)