HID Minidrivers and IRP_MJ_SHUTDOWN

Hello,

I was wondering if HID Minidrivers are allowed to implement IRP_MJ_SHUTDOWN. While it seems to work, I would not want to interfere with the HID class driver. I register my shutdown dispatch routine before calling HidRegisterMinidriver, call IoRegisterShutdownNotification in StartDevice, and call IoUnregisterShutdownNotification in either surprise removal or RemoveDevice, whichever arrives first. Looking at the docs, this link seems to imply that it would work, as nothing here suggests that HIDClass uses this dispatch routine:
http://msdn.microsoft.com/en-us/library/ff538342(v=VS.85).aspx

Also, nothing here suggests it’s illegal:
http://msdn.microsoft.com/en-us/library/ff538592(v=VS.85).aspx

Like I mentioned, it all does seem to work fine, but if someone in the know could confirm that this does not interfere with HID Class, I’d appreciate it.

thank you,

Philip Lukidis

why do you need to register for MJ_SHUTDOWN? why isn’t the SetPower/Sx irp good enough? MJ_SHUTDOWN is meant for legacy drivers, not pnp.

d

Thanks for your reply Doron,

In addition to sending some commands to my device, I need to write some state to the registry. Now I had *thought* that the registry was not available at SetPower/Sx time for shutdown/reboot, but perhaps my memory betrays me. I will try that out and see how it goes.
But out of curiosity, is the shutdown handler a problem for my minidriver? Would it cause problems for HIDClass?

Philip Lukidis


From: xxxxx@lists.osr.com [xxxxx@lists.osr.com] On Behalf Of xxxxx@Microsoft.com [xxxxx@Microsoft.com]
Sent: Friday, January 14, 2011 7:07 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] HID Minidrivers and IRP_MJ_SHUTDOWN

why do you need to register for MJ_SHUTDOWN? why isn’t the SetPower/Sx irp good enough? MJ_SHUTDOWN is meant for legacy drivers, not pnp.

d


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

MJ_SHUTDOWN is sent after SetPower/Sx, so if registry writes are no longer working for Sx, they will certainly not work for MJ_SHUTDOWN. Dont’ know if MJ_SHUTODOWN will work with a hid stack, we have never tested that scenario.

d

Doron,

Are you sure? At IRP_MJ_SHUTDOWN time the disk stacks are still functioning, though the registry services (and file systems) are already shut down.

shutdown is complicated. for the most part, the entire tree is sent a setpower/sx before MJ_SHUTDOWN is sent, the HID stack most certainly would have been sent the setpower.

d

> MJ_SHUTDOWN is sent after SetPower/Sx

At least for FSD and disk volume stacks, it is vice versa - first MJ_SHUTDOWN, then MJ_POWER.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

WDK docs:

“The registered DispatchShutdown routine is called before the power manager sends an IRP_MN_SET_POWER request for PowerSystemShutdown.”