From: Sushil on
Hi,
I have written a Bus driver based on KMDF Toaster dynamic bus driver.
I can plugin a device and load the corresponding driver. The only
problem I am facing in unplug & ejecting the device. Although while
trying device unplug i can see drivers got removed but if I see the
hidden device, the driver is still there and properties says device is
not connected(code 45).

Could anyone please help me in removing the device cleanly.

Thanks & regards,
Sushil
From: Sushil on
On Jul 7, 12:09 pm, Sushil <skd...(a)gmail.com> wrote:
> Hi,
> I have written a Bus driver based on KMDF Toaster dynamic bus driver.
> I can plugin a device and load the corresponding driver. The only
> problem I am facing in unplug & ejecting the device. Although while
> trying device unplug i can see drivers got removed but if I see the
> hidden device, the driver is still there and properties says device is
> not connected(code 45).
>
> Could anyone please help me in removing the device cleanly.
>
> Thanks & regards,
> Sushil

Event I tried MS Toaster example on WindowsXP and Windows 7, I am
getting the same issue.
enum -p 1
> driver loaded
enum -u 1 or enum -e 1
driver unloaded
but if I click on "show hidden devices"(set
devmgr_show_nonpresent_devices=1) option in device manager, I can see
the driver is still there and the properties says device is not
connected(code 45).

Is it the normal behavior, can't we completely removed the device?
Please help us in this regards.
From: Wilhelm Noeker on
Sushil wrote:

>> Hi,
>> I have written a Bus driver based on KMDF Toaster dynamic bus driver.
>> I can plugin a device and load the corresponding driver. The only
>> problem I am facing in unplug & ejecting the device. Although while
>> trying device unplug i can see drivers got removed but if I see the
>> hidden device, the driver is still there and properties says device is
>> not connected(code 45).
>
> Is it the normal behavior, can't we completely removed the device?
> Please help us in this regards.

Yes, this is normal behavior. You've just discovered the difference
between a PDO (which a bus driver can create and make disappear as it
pleases) and a device node (which is essentially what you're seeing in
the device manager).

There is a reason why device nodes are persistent like that: They
contain driver information. And that design allows you, for example, to
plug and unplug a USB device as often as you like, but you only have to
install the driver once.

If you want to delete the device node, too, you can do so from the
device manager, or via setup API calls (as shown in the devcon sample),
but not from your kernel driver itself.
From: Maxim S. Shatskih on
>Is it the normal behavior

Yes.

>, can't we completely removed the device?

"Uninstall" in the device manager.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com