Handling power IRPs in AVStream mini-drivers

Hi All,

I have implemented an AVStream mini-driver and I would like to handle
IRP_MN_SET_POWER mainly to find out when my Win XP system goes to
“PowerDeviceD3” or “PowerDeviceD0” states. I have set a callback routinue
in my KSDEVICE_DISPATCH and it gets called successfully. Following are the
actions i do in the callback routinue:

  1. Call PoStartNextPowerIrp ()
  2. IoSkipCurrentIrpStackLocation ()
  3. PoCallDriver ()
  4. Return STATUS_SUCCESS

No completion routinue is set. But i get an access violation after the
first IRP_MN_SET_POWER notification is complete. The details of the
violation (which i traced through windbg) is given below:

====================================
Access violation - code c0000005 (!!! second chance !!!)
nt!PoStartNextPowerIrp+14:
804d503a 8b80b0000000 mov eax,[eax+0xb0]

I get the violation after my callback routinue has completed successfully.
Can i anyone tell me what exactly this means and how to get around it?

Hari.


Looking for a laptop? Get cool deals.
http://www.baazee.com/static/Category152.html?MarketMedId=408 Only on
Baazee.

Hari K wrote:

I have implemented an AVStream mini-driver and I would like to handle
IRP_MN_SET_POWER mainly to find out when my Win XP system goes to
“PowerDeviceD3” or “PowerDeviceD0” states. I have set a callback routinue
in my KSDEVICE_DISPATCH and it gets called successfully. Following are the
actions i do in the callback routinue:

  1. Call PoStartNextPowerIrp ()
  2. IoSkipCurrentIrpStackLocation ()
  3. PoCallDriver ()
  4. Return STATUS_SUCCESS

I don’t think you should be trying to forward this IRP to another
driver, and I’m not sure what you mean by step “4” here since
AVStrMiniDeviceSetPower is a VOID function. I believe you should just
take note of the new power state and, possibly, do some device-specific
processing. Without looking into this further (all those pesky NDAs and
prohibitions on reverse engineering, you know), I’d guess that AVSTREAM
will call this callback *before* lowering power and *after* restoring
power, so you should have access to your hardware in both cases.


Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Now teaming with John Hyde for USB Device Engineering Seminars
Check out our schedule at http://www.oneysoft.com

You must not do default power processing yourself, AVStream does all this for you.
In your callback simply take care of your hardware and that’s it.

– Max.

— Hari K wrote:
> Hi All,
>
> I have implemented an AVStream mini-driver and I would like to handle
> IRP_MN_SET_POWER mainly to find out when my Win XP system goes to
> “PowerDeviceD3” or “PowerDeviceD0” states. I have set a callback routinue
> in my KSDEVICE_DISPATCH and it gets called successfully. Following are the
> actions i do in the callback routinue:
>
> 1) Call PoStartNextPowerIrp ()
> 2) IoSkipCurrentIrpStackLocation ()
> 3) PoCallDriver ()
> 4) Return STATUS_SUCCESS
>
> No completion routinue is set. But i get an access violation after the
> first IRP_MN_SET_POWER notification is complete. The details of the
> violation (which i traced through windbg) is given below:
>
> ====================================
> Access violation - code c0000005 (!!! second chance !!!)
> nt!PoStartNextPowerIrp+14:
> 804d503a 8b80b0000000 mov eax,[eax+0xb0]
> ====================================
>
> I get the violation after my callback routinue has completed successfully.
> Can i anyone tell me what exactly this means and how to get around it?
>
> Hari.
>
> _______________________________
> Looking for a laptop? Get cool deals.
> http://www.baazee.com/static/Category152.html?MarketMedId=408 Only on
> Baazee.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Thanks Max!

From: Max Paklin
>Reply-To: “NT Developers Interest List”
>To: “NT Developers Interest List”
>Subject: [ntdev] Re: Handling power IRPs in AVStream mini-drivers
>Date: Fri, 16 May 2003 14:35:53 -0700 (PDT)
>
>You must not do default power processing yourself, AVStream does all this
>for you.
>In your callback simply take care of your hardware and that’s it.
>
>– Max.
>
>
>
>— Hari K wrote:
> > Hi All,
> >
> > I have implemented an AVStream mini-driver and I would like to handle
> > IRP_MN_SET_POWER mainly to find out when my Win XP system goes to
> > “PowerDeviceD3” or “PowerDeviceD0” states. I have set a callback
>routinue
> > in my KSDEVICE_DISPATCH and it gets called successfully. Following are
>the
> > actions i do in the callback routinue:
> >
> > 1) Call PoStartNextPowerIrp ()
> > 2) IoSkipCurrentIrpStackLocation ()
> > 3) PoCallDriver ()
> > 4) Return STATUS_SUCCESS
> >
> > No completion routinue is set. But i get an access violation after the
> > first IRP_MN_SET_POWER notification is complete. The details of the
> > violation (which i traced through windbg) is given below:
> >
> > ====================================
> > Access violation - code c0000005 (!!! second chance !!!)
> > nt!PoStartNextPowerIrp+14:
> > 804d503a 8b80b0000000 mov eax,[eax+0xb0]
> > ====================================
> >
> > I get the violation after my callback routinue has completed
>successfully.
> > Can i anyone tell me what exactly this means and how to get around it?
> >
> > Hari.
> >
> > _______________________________
> > Looking for a laptop? Get cool deals.
> > http://www.baazee.com/static/Category152.html?MarketMedId=408 Only on
> > Baazee.
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@yahoo.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>

>Do you Yahoo!?
>The New Yahoo! Search - Faster. Easier. Bingo.
>http://search.yahoo.com
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com

_________________________________________________________________
Narain Karthikeyan. The fastest Indian.
http://server1.msn.co.in/msnspecials/narain/index.asp Know more about him.