Power IRP Pending Question

I have a questions regarding managing a Power IRP.

I’m kind of confused as to how the cleanly save context when processing
IRP_MN_SET_POWER.

I have an IRP that is active in the system that my driver has created. When
it is time to power down my device, I am trying to coordinate with the
cancellation of this IRP.

I am currently doing the following for a Power Down (When I Hibernate the
system):

  1. Receive IRP_MN_SET_POWER
  2. See if my special IRP is currently active
  3. If so, Cancel my special IRP, save the IRP_MN_SET_POWER IRP in my device
    extension, mark it pending and return STATUS_PENDING
  4. When my special IRP completion routine is called, with the Cancel error
    code I try and continue the processing of IRP_MN_SET_POWER by:

a. Setup the saved IRP_MN_SET_POWER for the next driver layer via
IoCopyCurrentIrpStackLocationToNext
b. Setup a Completion Routine for the IRP_MN_SET_POWER IRP
c. Call PoCallDriver to my lower level driver with the IRP
d. In the Completion routine, I call PoStartNextPowerIrp and return
the status of the Power IRP (Which is SUCCESS)

When all this is run, I crash the system with a IRQL_NOT_LESS_OR_EQUAL
(0x0000015A,0x0000002,0000,0x8042E338)

Is there something special I need to do with the Power IRP if I am marking
it Pending at the time of completion ?

Thanks

-Chris


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com