Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > IRP_MN_SET_POWER and toaster example
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 21st April 12:58
pjain
External User
 
Posts: 1
Default IRP_MN_SET_POWER and toaster example



Hello

I have modeled my power handling along the lines of toaster example in
the DDK. The example allocates context and work item and queues it,
which then gets scheduled at passive level. When running it under
driver verifier there are times allocation of context and/or work item
can fail. This is fine as far as the IRP_MN_QUERY_POWER is concerned
as we can fail the request. But as per DDK, the Device can never fail
the IRP_MN_SET_POWER IRP. The example (and my code) asserts if no
memory is available during IRP_MN_SET_POWER.

I am trying to figure out some way to avoid asserts and associated
failures during IRP_MN_SET_POWER resulting from memory allocation
failures and would appreciate suggestions.

My thought was to allocate the context and work item needed for both
QueryPower and SetPower in the StartIo routine and avoid the need to
allocate during power management IRPs. But I wasn't sure if there can
be multiple Device Query Power IRPs for the device active at the same
time and would appreciate confirmation.

Thanks in advance.

Puneet
  Reply With Quote


  sponsored links


2 21st April 12:58
walter oney
External User
 
Posts: 1
Default IRP_MN_SET_POWER and toaster example



You can have device and system power IRPs active at the same time, but
you won't have (say) a device query and a device set, or a system query
and a system set.

Handling error conditions in the middle of a power IRP is tricky. That's
why I built the elaborate state machine that you'll find in ch. 8 of my
WDM book and why I recommend to my seminar students that they simply
ship their drivers with a personalized copy of the GENERIC.SYS library
contained in the book samples. The PnP and power handling in GENERIC has
been thoroughly tested in many different types of driver at this point.

--
Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Check out our schedule at http://www.oneysoft.com
  Reply With Quote
3 21st April 12:59
pjain
External User
 
Posts: 1
Default IRP_MN_SET_POWER and toaster example


Thanks Walter for the info.
It is probably too late in the game to change the power handling to
use Generic. But I will follow your advice for the next driver
project, if and when that happens.

Puneet
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666