The problem:

I've developed a USB WDM driver that doesn't fall in any device
category, so I'm trying testing it with the "universal" test suite. As
soon as I select it in the HCT "Test Selection Wizard" window, and I
click on ok, the driver will not unload any more.


What's happening:

knowing that this kind of problems are caused by leaky references to
the device or driver object, I did my homework following the directions
provided by Eliyas ("Debugging a Failed Driver Unload" in the WinDbg
online help), looking for a mismatching
ObReferenceObject/ObDereferenceObject couple in my driver. I indeed
found one, but it's not in my driver: it's in kitdevis.sys, that
appears to be part of the HCT distribution. It seems that for some
reason, between two calls to my IRP_MN_QUERY_CAPABILITIES handler,
kitdevis.sys increments the reference counter of my device obejct, and
after that it never decrements it.

A thing to mention is that I'm borrowing the PNP handling code from
Walter Oney's WDM book, without any modification.
Another thing to mention is that I never experienced any problem in
unloading the driver, in months of developing and testing. It only
happens when I click "ok" in the Test Selection Wizard.

Now, I know I must be doing something very stupid, because it's
impossible that the HCT suite has such a macroscopic problem, but I've
no idea what. Does anybody know what could cause this behavior?

Thanks in advance!

Loris

RE: Why is the HCT preventing my driver from unloading? by Denny

Denny
Wed Apr 12 08:01:02 CDT 2006

Hi Loris,
I have the similar problem on USB descriptor test(see the thread "USB
Address Descriptor on amd64"). What version of HCT you are using?. Are you
having the same issue when you you do a surpise removal(not under testing)?
thanks,
--Denny


"loris.degioanni@gmail.com" wrote:

> The problem:
>
> I've developed a USB WDM driver that doesn't fall in any device
> category, so I'm trying testing it with the "universal" test suite. As
> soon as I select it in the HCT "Test Selection Wizard" window, and I
> click on ok, the driver will not unload any more.
>
>
> What's happening:
>
> knowing that this kind of problems are caused by leaky references to
> the device or driver object, I did my homework following the directions
> provided by Eliyas ("Debugging a Failed Driver Unload" in the WinDbg
> online help), looking for a mismatching
> ObReferenceObject/ObDereferenceObject couple in my driver. I indeed
> found one, but it's not in my driver: it's in kitdevis.sys, that
> appears to be part of the HCT distribution. It seems that for some
> reason, between two calls to my IRP_MN_QUERY_CAPABILITIES handler,
> kitdevis.sys increments the reference counter of my device obejct, and
> after that it never decrements it.
>
> A thing to mention is that I'm borrowing the PNP handling code from
> Walter Oney's WDM book, without any modification.
> Another thing to mention is that I never experienced any problem in
> unloading the driver, in months of developing and testing. It only
> happens when I click "ok" in the Test Selection Wizard.
>
> Now, I know I must be doing something very stupid, because it's
> impossible that the HCT suite has such a macroscopic problem, but I've
> no idea what. Does anybody know what could cause this behavior?
>
> Thanks in advance!
>
> Loris
>
>