From: Markov on
This is the error I get when I just pass the IRPs down

DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
The IO manager has caught a misbehaving driver.
Arguments:
Arg1: 0000000000000004, Invalid Device object passed to IoCallDriver
Arg2: fffff98002170fa0, the Device object
Arg3: 0000000000000000
Arg4: 0000000000000000

and its pointing to:
status = IoCallDriver( dx->NextLowerDriver, Irp);


"Markov" wrote:

> I tried that.
>
> Then the verifier started complaining about something else. I will post the
> details when I get a chance.
>
> "Tim Roberts" wrote:
>
> > Markov <Markov(a)discussions.microsoft.com> wrote:
> > >
> > >I am getting this when I enable Driver verifier on my driver
> > >
> > >DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> > >The IO manager has caught a misbehaving driver.
> > >Arguments:
> > >Arg1: 0000000000000220, IRP_MJ_SYSTEM_CONTROL has been completed by someone
> > >other than the ProviderId.
> > > This IRP should either have been completed earlier or should have been passed
> > > down.
> > >...
> > >Here is the part of the code its pointing at
> > >NTSTATUS MySystemControl(IN PDEVICE_OBJECT fdo, IN PIRP Irp)
> > >{
> > > NTSTATUS status;
> > > PDEVMSTR_DEVICE dx = (PDEVMSTR_DEVICE)fdo->DeviceExtension;
> > >
> > > if( dx->IODisabled)
> > > {
> > > Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED;
> > > Irp->IoStatus.Information = 0;
> > > IoCompleteRequest(Irp,IO_NO_INCREMENT);
> > > return STATUS_DEVICE_NOT_CONNECTED;
> > > }
> >
> > Expanding on Alexender's answer, IRP_MJ_SYSTEM_CONTROL is used to implement
> > WMI, and WMI needs to operate whether or not your device is enabled. You
> > have to pass them all along.
> > --
> > Tim Roberts, timr(a)probo.com
> > Providenza & Boekelheide, Inc.
> > .
> >
From: matt_sykes on
On 1 Apr, 01:15, Markov <Mar...(a)discussions.microsoft.com> wrote:
> This is the error I get when I just pass the IRPs down
>
> DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> The IO manager has caught a misbehaving driver.
> Arguments:
> Arg1: 0000000000000004, Invalid Device object passed to IoCallDriver
> Arg2: fffff98002170fa0, the Device object
> Arg3: 0000000000000000
> Arg4: 0000000000000000
>
> and its pointing to:
> status = IoCallDriver( dx->NextLowerDriver, Irp);
>
>
>
> "Markov" wrote:
> > I tried that.
>
> > Then the verifier started complaining about  something else. I will post the
> > details when I get a chance.
>
> > "Tim Roberts" wrote:
>
> > > Markov <Mar...(a)discussions.microsoft.com> wrote:
>
> > > >I am getting this when I enable Driver verifier on my driver
>
> > > >DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> > > >The IO manager has caught a misbehaving driver.
> > > >Arguments:
> > > >Arg1: 0000000000000220, IRP_MJ_SYSTEM_CONTROL has been completed by someone
> > > >other than the ProviderId.
> > > >  This IRP should either have been completed earlier or should have been passed
> > > >  down.
> > > >...
> > > >Here is the part of the code its pointing at
> > > >NTSTATUS MySystemControl(IN PDEVICE_OBJECT fdo, IN PIRP Irp)
> > > >{
> > > >  NTSTATUS status;
> > > >  PDEVMSTR_DEVICE dx = (PDEVMSTR_DEVICE)fdo->DeviceExtension;
>
> > > >  if( dx->IODisabled)
> > > >       {
> > > >              Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED;
> > > >        Irp->IoStatus.Information = 0;
> > > >        IoCompleteRequest(Irp,IO_NO_INCREMENT);
> > > >              return STATUS_DEVICE_NOT_CONNECTED;
> > > >        }
>
> > > Expanding on Alexender's answer, IRP_MJ_SYSTEM_CONTROL is used to implement
> > > WMI, and WMI needs to operate whether or not your device is enabled.  You
> > > have to pass them all along.
> > > --
> > > Tim Roberts, t...(a)probo.com
> > > Providenza & Boekelheide, Inc.
> > > .- Hide quoted text -
>
> - Show quoted text -

So dont clear your device initialising flag till you are on the stack.
From: Markov on
Matt,

Can you elaborate please?

Thanks.

"matt_sykes" wrote:

> On 1 Apr, 01:15, Markov <Mar...(a)discussions.microsoft.com> wrote:
> > This is the error I get when I just pass the IRPs down
> >
> > DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> > The IO manager has caught a misbehaving driver.
> > Arguments:
> > Arg1: 0000000000000004, Invalid Device object passed to IoCallDriver
> > Arg2: fffff98002170fa0, the Device object
> > Arg3: 0000000000000000
> > Arg4: 0000000000000000
> >
> > and its pointing to:
> > status = IoCallDriver( dx->NextLowerDriver, Irp);
> >
> >
> >
> > "Markov" wrote:
> > > I tried that.
> >
> > > Then the verifier started complaining about something else. I will post the
> > > details when I get a chance.
> >
> > > "Tim Roberts" wrote:
> >
> > > > Markov <Mar...(a)discussions.microsoft.com> wrote:
> >
> > > > >I am getting this when I enable Driver verifier on my driver
> >
> > > > >DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> > > > >The IO manager has caught a misbehaving driver.
> > > > >Arguments:
> > > > >Arg1: 0000000000000220, IRP_MJ_SYSTEM_CONTROL has been completed by someone
> > > > >other than the ProviderId.
> > > > > This IRP should either have been completed earlier or should have been passed
> > > > > down.
> > > > >...
> > > > >Here is the part of the code its pointing at
> > > > >NTSTATUS MySystemControl(IN PDEVICE_OBJECT fdo, IN PIRP Irp)
> > > > >{
> > > > > NTSTATUS status;
> > > > > PDEVMSTR_DEVICE dx = (PDEVMSTR_DEVICE)fdo->DeviceExtension;
> >
> > > > > if( dx->IODisabled)
> > > > > {
> > > > > Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED;
> > > > > Irp->IoStatus.Information = 0;
> > > > > IoCompleteRequest(Irp,IO_NO_INCREMENT);
> > > > > return STATUS_DEVICE_NOT_CONNECTED;
> > > > > }
> >
> > > > Expanding on Alexender's answer, IRP_MJ_SYSTEM_CONTROL is used to implement
> > > > WMI, and WMI needs to operate whether or not your device is enabled. You
> > > > have to pass them all along.
> > > > --
> > > > Tim Roberts, t...(a)probo.com
> > > > Providenza & Boekelheide, Inc.
> > > > .- Hide quoted text -
> >
> > - Show quoted text -
>
> So dont clear your device initialising flag till you are on the stack.
> .
>
From: matt_sykes on
On 1 Apr, 15:53, Markov <Mar...(a)discussions.microsoft.com> wrote:
> Matt,
>
> Can  you elaborate please?
>
> Thanks.
>
>
>
> "matt_sykes" wrote:
> > On 1 Apr, 01:15, Markov <Mar...(a)discussions.microsoft.com> wrote:
> > > This is the error I get when I just pass the IRPs down
>
> > > DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> > > The IO manager has caught a misbehaving driver.
> > > Arguments:
> > > Arg1: 0000000000000004, Invalid Device object passed to IoCallDriver
> > > Arg2: fffff98002170fa0, the Device object
> > > Arg3: 0000000000000000
> > > Arg4: 0000000000000000
>
> > > and its pointing to:
> > > status = IoCallDriver( dx->NextLowerDriver, Irp);
>
> > > "Markov" wrote:
> > > > I tried that.
>
> > > > Then the verifier started complaining about  something else. I will post the
> > > > details when I get a chance.
>
> > > > "Tim Roberts" wrote:
>
> > > > > Markov <Mar...(a)discussions.microsoft.com> wrote:
>
> > > > > >I am getting this when I enable Driver verifier on my driver
>
> > > > > >DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> > > > > >The IO manager has caught a misbehaving driver.
> > > > > >Arguments:
> > > > > >Arg1: 0000000000000220, IRP_MJ_SYSTEM_CONTROL has been completed by someone
> > > > > >other than the ProviderId.
> > > > > >  This IRP should either have been completed earlier or should have been passed
> > > > > >  down.
> > > > > >...
> > > > > >Here is the part of the code its pointing at
> > > > > >NTSTATUS MySystemControl(IN PDEVICE_OBJECT fdo, IN PIRP Irp)
> > > > > >{
> > > > > >  NTSTATUS status;
> > > > > >  PDEVMSTR_DEVICE dx = (PDEVMSTR_DEVICE)fdo->DeviceExtension;
>
> > > > > >  if( dx->IODisabled)
> > > > > >       {
> > > > > >              Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED;
> > > > > >        Irp->IoStatus.Information = 0;
> > > > > >        IoCompleteRequest(Irp,IO_NO_INCREMENT);
> > > > > >              return STATUS_DEVICE_NOT_CONNECTED;
> > > > > >        }
>
> > > > > Expanding on Alexender's answer, IRP_MJ_SYSTEM_CONTROL is used to implement
> > > > > WMI, and WMI needs to operate whether or not your device is enabled.  You
> > > > > have to pass them all along.
> > > > > --
> > > > > Tim Roberts, t...(a)probo.com
> > > > > Providenza & Boekelheide, Inc.
> > > > > .- Hide quoted text -
>
> > > - Show quoted text -
>
> > So dont clear your device initialising flag till you are on the stack.
> > .- Hide quoted text -
>
> - Show quoted text -

in your add device handler you end by clearing the initialising flag
from the device object. Until you do this the IO manager wont send
you any IRPs. It seems to me that you are clearing this flag before
attcching to the device stack, whcih is why you have an invalid DO
pointer for the lower device at the point you get an IRP.

From: Markov on
This is the last thing done in the add device handler

fdo->Flags &= ~DO_DEVICE_INITIALIZING;

Thanks

"matt_sykes" wrote:

> On 1 Apr, 15:53, Markov <Mar...(a)discussions.microsoft.com> wrote:
> > Matt,
> >
> > Can you elaborate please?
> >
> > Thanks.
> >
> >
> >
> > "matt_sykes" wrote:
> > > On 1 Apr, 01:15, Markov <Mar...(a)discussions.microsoft.com> wrote:
> > > > This is the error I get when I just pass the IRPs down
> >
> > > > DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> > > > The IO manager has caught a misbehaving driver.
> > > > Arguments:
> > > > Arg1: 0000000000000004, Invalid Device object passed to IoCallDriver
> > > > Arg2: fffff98002170fa0, the Device object
> > > > Arg3: 0000000000000000
> > > > Arg4: 0000000000000000
> >
> > > > and its pointing to:
> > > > status = IoCallDriver( dx->NextLowerDriver, Irp);
> >
> > > > "Markov" wrote:
> > > > > I tried that.
> >
> > > > > Then the verifier started complaining about something else. I will post the
> > > > > details when I get a chance.
> >
> > > > > "Tim Roberts" wrote:
> >
> > > > > > Markov <Mar...(a)discussions.microsoft.com> wrote:
> >
> > > > > > >I am getting this when I enable Driver verifier on my driver
> >
> > > > > > >DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
> > > > > > >The IO manager has caught a misbehaving driver.
> > > > > > >Arguments:
> > > > > > >Arg1: 0000000000000220, IRP_MJ_SYSTEM_CONTROL has been completed by someone
> > > > > > >other than the ProviderId.
> > > > > > > This IRP should either have been completed earlier or should have been passed
> > > > > > > down.
> > > > > > >...
> > > > > > >Here is the part of the code its pointing at
> > > > > > >NTSTATUS MySystemControl(IN PDEVICE_OBJECT fdo, IN PIRP Irp)
> > > > > > >{
> > > > > > > NTSTATUS status;
> > > > > > > PDEVMSTR_DEVICE dx = (PDEVMSTR_DEVICE)fdo->DeviceExtension;
> >
> > > > > > > if( dx->IODisabled)
> > > > > > > {
> > > > > > > Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED;
> > > > > > > Irp->IoStatus.Information = 0;
> > > > > > > IoCompleteRequest(Irp,IO_NO_INCREMENT);
> > > > > > > return STATUS_DEVICE_NOT_CONNECTED;
> > > > > > > }
> >
> > > > > > Expanding on Alexender's answer, IRP_MJ_SYSTEM_CONTROL is used to implement
> > > > > > WMI, and WMI needs to operate whether or not your device is enabled. You
> > > > > > have to pass them all along.
> > > > > > --
> > > > > > Tim Roberts, t...(a)probo.com
> > > > > > Providenza & Boekelheide, Inc.
> > > > > > .- Hide quoted text -
> >
> > > > - Show quoted text -
> >
> > > So dont clear your device initialising flag till you are on the stack.
> > > .- Hide quoted text -
> >
> > - Show quoted text -
>
> in your add device handler you end by clearing the initialising flag
> from the device object. Until you do this the IO manager wont send
> you any IRPs. It seems to me that you are clearing this flag before
> attcching to the device stack, whcih is why you have an invalid DO
> pointer for the lower device at the point you get an IRP.
>
> .
>