Hi, I have question about unloading the driver. I am
writing a virtual network driver. However, I often have
problem to undisable or unload the virtual network
device. Whenever the device is disabled or unloaded, I
expect Windows will run HaltHandler routine. It does not
seem to happen on WinDbg when I have problem to disable or
unload the device. Any idea? Thanks in advance.

How to unload the device driver by Matt

Matt
Tue Dec 16 05:04:42 CST 2003

I have never been able to dynamically unload an NDIS NIC
driver which supports 802.3. As you say, its halt
function never gets called.

I have been able to unload a NIC driver that used a custom
protocol driver, and in this case I was warned that the
protocol would unload too.

I guess that with 802.3, because you have a TCP/IP
protocol on top of it, and on top of that you have the
varions services, browser, RPC etc, there are open handles
to the TDI from user mode, and so the NIC can't be
released.

I suppose you could try turning off all the services and
then try.

ATB

Matt




>-----Original Message-----
>Hi, I have question about unloading the driver. I am
>writing a virtual network driver. However, I often have
>problem to undisable or unload the virtual network
>device. Whenever the device is disabled or unloaded, I
>expect Windows will run HaltHandler routine. It does not
>seem to happen on WinDbg when I have problem to disable
or
>unload the device. Any idea? Thanks in advance.
>.
>

Re: How to unload the device driver by Maxim

Maxim
Tue Dec 16 08:32:57 CST 2003

> I guess that with 802.3, because you have a TCP/IP
> protocol on top of it, and on top of that you have the
> varions services, browser, RPC etc, there are open handles
> to the TDI from user mode, and so the NIC can't be
> released.

NICs can be unloaded from under the protocol.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com



Re: How to unload the device driver by Stephan

Stephan
Tue Dec 16 12:33:10 CST 2003

You MiniportHalt() will for sure get called before the miniport driver
gets unloaded.

Note that virtual adapters of MUX intermediate drivers need to be
started by the driver itself via NdisIMInitializeDeviceInstance(). But
MiniportInitialize() might still not get called if the adapter has
been manually disabled by the user (see also
http://groups.google.com/groups?threadm=qh75qvoel176lba61lt0nhn48php857bsl%404ax.com).

Note also that NDIS will only unload a MUX driver when all protocol
bindings are closed, NdisMDeregisterDevice() has been called if
applicable, and MiniportHalt() has been called for all previously
initialized virtual adapter instances, in this order.

If your driver is not a MUX IM, what kind of driver is this? NDIS_WDM?

Stephan
---
On Fri, 12 Dec 2003 15:08:37 -0800, "Billy Ng"
<ngbh_NO_SPAM@nswc.navy.mil_INVALID> wrote:

>Hi, I have question about unloading the driver. I am
>writing a virtual network driver. However, I often have
>problem to undisable or unload the virtual network
>device. Whenever the device is disabled or unloaded, I
>expect Windows will run HaltHandler routine. It does not
>seem to happen on WinDbg when I have problem to disable or
>unload the device. Any idea? Thanks in advance.