Driver does not Unload after install: How to delete Control device?

I have a driver which requires a reboot after update installation.

Fact 1: The setupapi.log is saying
dvi: {Restarting Devices} 13:22:09.209
dvi: Query-remove: USB\VID_xxx&PID_xxx&MI_xxxx
dvi: Query-remove complete
dvi: Driver ‘xxxx’ required reboot: Driver did not unload.
dvi: Restart: USB\VID_xxx&PID_xxx&MI_xxxx
dvi: Restart complete.
dvi: {Restarting Devices exit} 13:22:09.307

Fact 2: The driver creates an additional control device in DriverEntry() with WdfDeviceCreate(). If I suppress creation of this device, Unload is OK.

My theory:

  • The driver does not unload because the Non-PnP Control Device is present.
  • The driver object is deleted after unloading
  • The control device would be deleted if the driver object is deleted (parent relationship), but Unloading never happens.

Question: how to enable “Unload” if a Non-PnP Control Device is present?

Thanks for caring,
Joerg Hoppe, PEAK-System-Technik, Germany

You need to delete the control device object when the last pnp device object is deleted. You should create the control device in EvtDriverDeviceAdd, not DriverEntry

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@t-online.de
Sent: Monday, July 6, 2015 7:15 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Driver does not Unload after install: How to delete Control device?

I have a driver which requires a reboot after update installation.

Fact 1: The setupapi.log is saying
dvi: {Restarting Devices} 13:22:09.209
dvi: Query-remove: USB\VID_xxx&PID_xxx&MI_xxxx
dvi: Query-remove complete
dvi: Driver ‘xxxx’ required reboot: Driver did not unload.
dvi: Restart: USB\VID_xxx&PID_xxx&MI_xxxx
dvi: Restart complete.
dvi: {Restarting Devices exit} 13:22:09.307

Fact 2: The driver creates an additional control device in DriverEntry() with WdfDeviceCreate(). If I suppress creation of this device, Unload is OK.

My theory:
- The driver does not unload because the Non-PnP Control Device is present.
- The driver object is deleted after unloading
- The control device would be deleted if the driver object is deleted (parent relationship), but Unloading never happens.

Question: how to enable “Unload” if a Non-PnP Control Device is present?

Thanks for caring,
Joerg Hoppe, PEAK-System-Technik, Germany


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