Re: Loading Unloading NDIS Intermediate Dirver

Tech-Archive recommends: Fix windows errors by optimizing your registry



Jeff Kelley [MS] wrote:
1. Each miniport adapter must have a unique name. When an intermediate driver inserts itself between an underlying adapter and a protocol driver, the underlying adapter continues to exist so its name is still in use.Thus the intermediate driver must create a new adapter name. The Passthru intermediate does this by prefixing "PASS\" to the underlying adapter name. The only idea that comes to mind for presenting the same name to the user would be to use a "FriendlyName" registry value in the adapter parameters which the UI could use, and that could be set the same for both. That would require that the UI applications consistently use that value.

Thanks this is what I suspected. Just thought I would check and see if there was some undocumented way around this.

2. An NDIS layered intermediate driver consists of a protocol driver part and a miniport driver part. NDIS doesn't define a mechanism for loading and unloading protocol drivers. So, the unloading of an intermediate driver must be done through a custom method (e.g. a custom stream driver interface). Prior to unloading, all the adapter instances that it created must be deleted, and the driver must deregister from NDIS.


My driver has a streams interface that issues the UNBIND IOCTL to Ndis. This driver could also use NdisUnbindProtocolsFromAdapter(). The unloading is being commanded externally through an application. There is only 1 adapter the IM is bound to so the IOCTL is issued and cleanup proceeds successfully on the bound adapter. The virtual miniports it creates disappear from the system and the original miniport is restored. The intermediate driver registers an unload handler but it never gets called. As mentioned earlier NdisDeregisterProtocol() does not help to unload the DLL. What causes the unload handler from a protocol driver to get called and subsequently the DLL released from memory?


The ce-streams driver is deregistered using DeactivateDevice() which succeeds fine. However the DLL is still loaded in memory due to something else in the NDIS stack having a reference to it. This instance has no miniports and the miniport-side has been deregistered using NdisIMDeregisterLayeredMiniport(). So that leaves the protocol still registered. NdisDeregisterProtocol() was called in the Ce-streams driver _Deinit() method and the status did not return an error.

What is the proper method to "deregister" the IM driver from NDIS. There are methods to deregister a miniport adapter instance (ie NdisDeregisterAdapter()). I've used this in previous drivers to unload a virtual NIC and it works well (and allows the DLL to be unloaded). There doesn't appear to be a corresponding API when a IM driver registers a protocol and creates it's own miniport instances.
.




Relevant Pages

  • PATCH: docs for updated sk98 from vendor
    ... +Marvell Yukon/SysKonnect SK-98xx Gigabit Ethernet Adapter family driver for LINUX ... the driver is integrated in the linux kernel source. ... both link partners are allowed to send PAUSE frames ...
    (Linux-Kernel)
  • Re: [RFC][PATCH] SPI subsystem
    ... Are you expecting the adapter ... > driver to handle the fact that its transfer routine could be called ... > a message or another CS line which is really a GPO pin used for register ... For example a char LCD with SPI interface ...
    (Linux-Kernel)
  • Re: Regression (gdm no longer shuts down) - 2.4.24.x and 2.6.25
    ... What gave you the idea to try unloading this driver? ... the chip at 0x50 is an EDID EEPROM in your ...
    (Linux-Kernel)
  • Re: Ataptec SCSI card problem
    ... I tried to install this card debian 4.0, ubuntu 7.10, Fedora Core 8, ... Slackware 12 and I have always the same message from scsi card. ... what it looks like to me, the problem is to be found in the driver, rather ... SCSI adapter family, which means that they can be used in two modes, i.e. ...
    (comp.os.linux.hardware)
  • Re: Using NDISProto protocol
    ... There is no way to guarantee that your software is the only software controlling an 802.11 adapter. ... Your hiding IM driver would battle with other hiding IM drivers and who knows whether your hiding IM driver would win over another. ... i make sure that my protocol driver is used instead of the ndisuio ... Also by the second method am I opening a handle to the miniport driver ...
    (microsoft.public.development.device.drivers)