天天看點

Power IRPs處理注意點

  <Programming the Microsoft Windows Driver Model>第8章8.1節提到處理Power Irp的注意點:

"Power IRPs come to you in the context of a system thread that you must not block. There are several reasons why you can’t

block the thread. If your device has the INRUSH characteristic, or if you’ve cleared the DO_POWER_PAGABLE flag in your

device object, the Power Manager will send you IRPs at DISPATCH_LEVEL. You remember, of course, that you can’t block a

thread while executing at DISPATCH_LEVEL. Even if you’ve set DO_POWER_PAGABLE, however, so that you get power

IRPs at PASSIVE_LEVEL, you can cause a deadlock by requesting a device power IRP while servicing a system IRP and then

blocking: the Power Manager might not send you the device IRP until your system IRP dispatch routine returns, so you’ll wait forever."

繼續閱讀