UMDF 2.0 Driver: registering for device arrival/removal

I have a functioning UMDF 1.x driver that registers for a particular class of devices.

I am now tasked with looking into porting this driver over to UMDF 2.0 so that more source code can be shared between KMDF and UMDF 2.0 drivers.

The issue I’m running into is that IoRegisterPlugPlayNotification seems to be only available for kernel mode drivers (defined in wdm.h). There is RegisterDeviceNotification in usermode, but my driver isn’t a windows application nor a service.

There surely has to be a way to do this, but I simply unable to find anything in MSDN nor the WDK 8.1 samples.

Is such registration for PnP notification not available to UMDF 2.0 drivers? I would be surprised, given the support in UMDF 1.x drivers due to a loss in functionality. Any tips would be greatly appreciated.

You need to use CM_Register_Notification
(http://msdn.microsoft.com/en-us/library/windows/hardware/Hh780224(v=vs.85).aspx)
in UMDF 2.0 drivers. A doc update will be published soon.

-kumar
WDF Team

wrote in message news:xxxxx@ntdev…

I have a functioning UMDF 1.x driver that registers for a particular class
of devices.

I am now tasked with looking into porting this driver over to UMDF 2.0 so
that more source code can be shared between KMDF and UMDF 2.0 drivers.

The issue I’m running into is that IoRegisterPlugPlayNotification seems to
be only available for kernel mode drivers (defined in wdm.h). There is
RegisterDeviceNotification in usermode, but my driver isn’t a windows
application nor a service.

There surely has to be a way to do this, but I simply unable to find
anything in MSDN nor the WDK 8.1 samples.

Is such registration for PnP notification not available to UMDF 2.0 drivers?
I would be surprised, given the support in UMDF 1.x drivers due to a loss in
functionality. Any tips would be greatly appreciated.

Thanks Kumar!

Small correction on the URL, http://msdn.microsoft.com/en-us/library/windows/hardware/Hh780224(v=vs.85).aspx

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Kumar Rajeev
Sent: Wednesday, October 16, 2013 9:40 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] UMDF 2.0 Driver: registering for device arrival/removal

You need to use CM_Register_Notification
(http://msdn.microsoft.com/en-us/library/windows/hardware/Hh780224(v=vs.85).aspx)
in UMDF 2.0 drivers. A doc update will be published soon.

-kumar
WDF Team

wrote in message news:xxxxx@ntdev…

I have a functioning UMDF 1.x driver that registers for a particular class of devices.

I am now tasked with looking into porting this driver over to UMDF 2.0 so that more source code can be shared between KMDF and UMDF 2.0 drivers.

The issue I’m running into is that IoRegisterPlugPlayNotification seems to be only available for kernel mode drivers (defined in wdm.h). There is RegisterDeviceNotification in usermode, but my driver isn’t a windows application nor a service.

There surely has to be a way to do this, but I simply unable to find anything in MSDN nor the WDK 8.1 samples.

Is such registration for PnP notification not available to UMDF 2.0 drivers?
I would be surprised, given the support in UMDF 1.x drivers due to a loss in functionality. Any tips would be greatly appreciated.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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

I have one last question. Are there any race conditions at tear down time (due to device being removed or system shutting down) with calling CM_Unregister_Notification and then exiting? Or does CM_Unregister_Notification flush any queued events?

CM_Unregister_Notification will make sure all the pending notifications are
completed.

-kumar

wrote in message news:xxxxx@ntdev…

I have one last question. Are there any race conditions at tear down time
(due to device being removed or system shutting down) with calling
CM_Unregister_Notification and then exiting? Or does
CM_Unregister_Notification flush any queued events?