Re: NDIS IM & NdisMDeregisterDevice
- From: "Thomas F. Divine" <tdivine@NOpcausaSPAM>
- Date: Wed, 13 Dec 2006 10:55:17 -0500
"TarasCo" <taralex@xxxxxxxxx> wrote in message news:1166022733.452367.16130@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
As I know, i should call NdisMDeregisterDevice in MiniportHalt routineYou must find a way to inform the app that the binding has gone away.
when last miniport is halted (
http://groups.google.ru/group/comp.os.ms-windows.programmer.nt.kernel-mode/browse_thread/thread/1d8ee27725dd24c2/b8e565e360364c61?lnk=st&q=NdisMDeregisterDevice+Unload&rnum=1&hl=ru#b8e565e360364c61)
Then my driver will be unloaded. But if client app has opened handle on
my device, driver is still in memory. I can understand why. When app
close the last handle i suggest calling driver Unload routine, but
driver is still referenced. I can notify app about stop, but I think
when app handle such notify it will be late. What sould I do?
You can create an asynchronous "notification" IOCTL that the application calls. The driver would pend the IRP for this IOCTL indefinitely. Basically until some event occurs that requires the driver to notify the app. When such an event occurs the driver would complete the IRP providing the detains of the "event" in some output buffer structure of your invention.
The application would periodically test the pended IOCTL to become aware of the notification from the driver. I believe the NDISPROT sample may include an illustration of some sort of notification callback scheme.
In user mode you could also use asynchronous procedure callback method to have a routine in your application be called when the driver completes the IRP. Using APC's does require the systematic use of user-mode wait operations in the "alertable" state; overlooking this need will make APCs fail to work.
Alternatively, and possibly simpler, you could just have your application poll the handle on each adapter periodically. Just have some sort of IOCTL (e.g., fetch some status or statistics of your invention). When the app makes such a call on an adapter that has become unbound, fail the call with invalid handle status. When app sees invalid handle returned form such a keep-alive, require it to close all handles.
Thomas F. Divine
.
- Follow-Ups:
- Re: NDIS IM & NdisMDeregisterDevice
- From: soviet_bloke
- Re: NDIS IM & NdisMDeregisterDevice
- From: TarasCo
- Re: NDIS IM & NdisMDeregisterDevice
- References:
- NDIS IM & NdisMDeregisterDevice
- From: TarasCo
- NDIS IM & NdisMDeregisterDevice
- Prev by Date: NDIS IM & NdisMDeregisterDevice
- Next by Date: Re: NDIS IM & NdisMDeregisterDevice
- Previous by thread: NDIS IM & NdisMDeregisterDevice
- Next by thread: Re: NDIS IM & NdisMDeregisterDevice
- Index(es):
Relevant Pages
|