driver unload

Hello,

I’ve been bogged down with this issue of

" Windows cannot load the device driver for this hardware because a previous
instance of the device driver is still in memory ".

This happens with a USB driver during suprise removal that has a bus
driver+few PDO+FDO for each PDO.

I have stepped through all PnP IRP and did not find anything wrong and
driver unload routined is called as well.

Driver verifier is running and the bug does not go away if I turn off
verifier.

I can look on all extensions and see that nothing is pending there after the
unload since driver memory is still resident.

It seems that I need to find all the references to my driver. Any idea how
should I proceed?

Thanks,
Hakim

This is most likely a dangling ObReferenceObject call that does not have
a matched ObDerefenceObject call. You can dump the reference count by
running !object for each device object in windbg.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Hakim
Sent: Thursday, October 06, 2005 12:13 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] driver unload

Hello,

I’ve been bogged down with this issue of

" Windows cannot load the device driver for this hardware because a
previous
instance of the device driver is still in memory ".

This happens with a USB driver during suprise removal that has a bus
driver+few PDO+FDO for each PDO.

I have stepped through all PnP IRP and did not find anything wrong and
driver unload routined is called as well.

Driver verifier is running and the bug does not go away if I turn off
verifier.

I can look on all extensions and see that nothing is pending there after
the
unload since driver memory is still resident.

It seems that I need to find all the references to my driver. Any idea
how
should I proceed?

Thanks,
Hakim


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

All the counts of device objects are:

HandleCount: 0 PointerCount: 1

Any other issues to look at?

Thanks,
Hakim

“Doron Holan” wrote in message
news:xxxxx@ntdev…
This is most likely a dangling ObReferenceObject call that does not have
a matched ObDerefenceObject call. You can dump the reference count by
running !object for each device object in windbg.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Hakim
Sent: Thursday, October 06, 2005 12:13 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] driver unload

Hello,

I’ve been bogged down with this issue of

" Windows cannot load the device driver for this hardware because a
previous
instance of the device driver is still in memory ".

This happens with a USB driver during suprise removal that has a bus
driver+few PDO+FDO for each PDO.

I have stepped through all PnP IRP and did not find anything wrong and
driver unload routined is called as well.

Driver verifier is running and the bug does not go away if I turn off
verifier.

I can look on all extensions and see that nothing is pending there after
the
unload since driver memory is still resident.

It seems that I need to find all the references to my driver. Any idea
how
should I proceed?

Thanks,
Hakim


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Do this.

  1. track the pointer values of all the device objects you created
  2. when the last device object is deleted, run !object on each one in
    the created list. You might get some garbage b/c of memory reuse, but
    you might also catch the leaked reference.

You can also set a break on address write on the reference count, the
ref count is some negative number of bytes before the devobj pointer
value (I think 16 on a 32 bit machine), something like this

ba w4

"dd l1;kb;g"

will break in, dump the current value and then continue

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Hakim
Sent: Thursday, October 06, 2005 2:28 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] driver unload

All the counts of device objects are:

HandleCount: 0 PointerCount: 1

Any other issues to look at?

Thanks,
Hakim

"Doron Holan" wrote in message
news:xxxxx@ntdev...
This is most likely a dangling ObReferenceObject call that does not have
a matched ObDerefenceObject call. You can dump the reference count by
running !object for each device object in windbg.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Hakim
Sent: Thursday, October 06, 2005 12:13 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] driver unload

Hello,

I've been bogged down with this issue of

" Windows cannot load the device driver for this hardware because a
previous
instance of the device driver is still in memory ".

This happens with a USB driver during suprise removal that has a bus
driver+few PDO+FDO for each PDO.

I have stepped through all PnP IRP and did not find anything wrong and
driver unload routined is called as well.

Driver verifier is running and the bug does not go away if I turn off
verifier.

I can look on all extensions and see that nothing is pending there after
the
unload since driver memory is still resident.

It seems that I need to find all the references to my driver. Any idea
how
should I proceed?

Thanks,
Hakim

---
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

---
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com