ndis protocol driver not getting unloaded

hi all
i am encountering the following problem:-

if there is a user mdoe application that is holding a handle to the driver
obtained by using the CreateFile call (for making ioctl calls), and then
if i try to stop the ndis protocol driver using the services panel, then the
driver
doesnt stop. on debuggng through the softice, it was found that unload
routine is not getting called.
Currently , unbindadapter and deregisterprotocol functions are being called
from within the unload routine.
can anybody help?? is there any way of calling unload routine
when an application still holds a handle to the driver

(driver being tested on windows 2000)
thanks in advance
Mayank

This is an inherent problem with IOCTL. It’s best if the driver can notify the
user-space program to close the handle. One way to accomplish that is to have an
asynchronous IOCTL that the driver completes when the driver decides the handle
should be shut. But things still depend on the program handling the completed
IOCTL correctly and closing.

WMI, described in an upcoming http://www.wd-3.com/ article, doesn’t have this
shortcoming.

Mayank Kumar wrote:

if there is a user mdoe application that is holding a handle to the driver
obtained by using the CreateFile call (for making ioctl calls), and then
if i try to stop the ndis protocol driver using the services panel, then the
driver
doesnt stop. on debuggng through the softice, it was found that unload
routine is not getting called.
Currently , unbindadapter and deregisterprotocol functions are being called
from within the unload routine.
can anybody help?? is there any way of calling unload routine
when an application still holds a handle to the driver


If replying by e-mail, please remove “nospam.” from the address.

James Antognini
Windows DDK MVP

The bottom line is that the Win32 application MUST close the handle before
the NDIS protocol driver can successfully unload.

As James suggested, having a pending IRP that the driver queues and then
completes as part of cleanup is the most common solution to this problem.

Thomas F. Divine
www.rawether.net

“Mayank Kumar” wrote in message
news:xxxxx@ntdev…
>
> hi all
> i am encountering the following problem:-
>
> if there is a user mdoe application that is holding a handle to the driver
> obtained by using the CreateFile call (for making ioctl calls), and then
> if i try to stop the ndis protocol driver using the services panel, then
the
> driver
> doesnt stop. on debuggng through the softice, it was found that unload
> routine is not getting called.
> Currently , unbindadapter and deregisterprotocol functions are being
called
> from within the unload routine.
> can anybody help?? is there any way of calling unload routine
> when an application still holds a handle to the driver
>
> (driver being tested on windows 2000)
> thanks in advance
> Mayank
>
>
>

The driver will not be unloaded as long as there is a reference to it,
including an open handle.

Bryan S. Burgin
xxxxx@microsoft.com

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mayank Kumar
Sent: Wednesday, December 17, 2003 12:45 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] ndis protocol driver not getting unloaded

hi all
i am encountering the following problem:-

if there is a user mdoe application that is holding a handle to the
driver
obtained by using the CreateFile call (for making ioctl calls), and then
if i try to stop the ndis protocol driver using the services panel, then
the
driver
doesnt stop. on debuggng through the softice, it was found that unload
routine is not getting called.
Currently , unbindadapter and deregisterprotocol functions are being
called
from within the unload routine.
can anybody help?? is there any way of calling unload routine
when an application still holds a handle to the driver

(driver being tested on windows 2000)
thanks in advance
Mayank


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