IM driver uninstall issue.

A quick question about the uninstall of an NDIS intermediate driver. I’ve
written such a driver based on the “Writing an NDIS intermediate driver”
article at msdn. The problem is that when I uninstall the driver from the
Network Connection properties page, it hangs in
NdisIMDeInitializeDeviceInstance() for about 7 minutes before calling my
MiniportHalt() function and then returning success and unloading properly.
I don’t believe I am doing anything wrong, but I can’t figure out why this
pauses for so long.

The odd thing is that sometimes it returns immediately, but mostly it will
hang for some time. It’s a bit annoying as it slows down development and
testing.

This problem was also mentioned in february by xxxxx@necas.nec.co.jp
(“about NdisIMDeInitializeDeviceInstance”), but I didn’t see any answers to
the issue.

I have also compiled the MS passthru driver, and it exhibits the same
behavior.

This is on Win2k/SP2 with the Win2k ddk.

Any ideas?

TIA,
fes


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hmm, it seems you don’t really need uninstall but reload driver instead.
IIRC there were problems with real uninstalls (driver image remains in
memory or something like this). OS unloads your driver when you disable all
your devices and loads it back when devices are re-enabled. You can do it
using GUI (slow) or write an app which performs it automatically (see w2k
DDK enable example [src\general\setup\Enable]). I successfully developed w2k
NDIS filter driver this way with almost no reboot. Note if your driver is
creating extra devices using NdisMRegisterDevice, above may not work if
devices exist after all adapters are disabled. I solved this problems
creating devices in MiniportInitialize and destroying them in MiniportHalt.

As for long waiting, it may be caused by outstanding packets. Ensure that
beforre calling NdisIMDeinitializeDeviceInstance all queued packets are
completed (probably including these sent to below driver). NDIS references
you miniport context when a packet is sent and dereferences when completed.
It doesn’t call MiniportHalt until reference count is zero. Maybe there is
some timeout, I can’t remember.

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]


From: xxxxx@digitalheroin.net[SMTP:xxxxx@digitalheroin.net]
Reply To: xxxxx@lists.osr.com
Sent: Sunday, November 25, 2001 8:32 PM
To: xxxxx@lists.osr.com
Subject: [ntdev] IM driver uninstall issue.

A quick question about the uninstall of an NDIS intermediate driver. I’ve

written such a driver based on the “Writing an NDIS intermediate driver”
article at msdn. The problem is that when I uninstall the driver from the

Network Connection properties page, it hangs in
NdisIMDeInitializeDeviceInstance() for about 7 minutes before calling my
MiniportHalt() function and then returning success and unloading properly.

I don’t believe I am doing anything wrong, but I can’t figure out why this

pauses for so long.

The odd thing is that sometimes it returns immediately, but mostly it will

hang for some time. It’s a bit annoying as it slows down development and
testing.

This problem was also mentioned in february by xxxxx@necas.nec.co.jp
(“about NdisIMDeInitializeDeviceInstance”), but I didn’t see any answers
to
the issue.

I have also compiled the MS passthru driver, and it exhibits the same
behavior.

This is on Win2k/SP2 with the Win2k ddk.

Any ideas?

TIA,
fes


You are currently subscribed to ntdev as: michal.vodicka@st.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

That sounds like a pretty good idea. Right now I’ve just been
uninstalling, and then using the SCManager to remove the image from memory.
Simply disabling and then re-enabling the devices should be much faster.
And since removing the IM driver effectively kills of connections anyway,
it shouldn’t cause any unnecessary problems.

As for the delay, I did try replacing MiniportSend, ProtocolReceivePacket,
etc., with functions that just returned the packet rather than processing
it, which would mean that there should never be an outstanding packet
request to test that scenario. However, I still got the delay. Though if
you don’t get such a delay in your driver, it must be something in common
between my driver and the passthru.

Thanks for the advice. I’ll implement similar functionality and see if
that helps.

fes

On 11/26/01, “Michal Vodicka ” wrote:
> Hmm, it seems you don’t really need uninstall but reload driver instead.
> IIRC there were problems with real uninstalls (driver image remains in
> memory or something like this). OS unloads your driver when you disable all
> your devices and loads it back when devices are re-enabled. You can do it
> using GUI (slow) or write an app which performs it automatically (see w2k
> DDK enable example [src\general\setup\Enable]). I successfully developed w2k
> NDIS filter driver this way with almost no reboot. Note if your driver is
> creating extra devices using NdisMRegisterDevice, above may not work if
> devices exist after all adapters are disabled. I solved this problems
> creating devices in MiniportInitialize and destroying them in MiniportHalt.
>
> As for long waiting, it may be caused by outstanding packets. Ensure that
> beforre calling NdisIMDeinitializeDeviceInstance all queued packets are
> completed (probably including these sent to below driver). NDIS references
> you miniport context when a packet is sent and dereferences when completed.
> It doesn’t call MiniportHalt until reference count is zero. Maybe there is
> some timeout, I can’t remember.
>
> Best regards,
>
> Michal Vodicka
> STMicroelectronics Design and Application s.r.o.
> [michal.vodicka@st.com, http:://www.st.com]
>
> > ----------
> > From: xxxxx@digitalheroin.net[SMTP:xxxxx@digitalheroin.net]
> > Reply To: xxxxx@lists.osr.com
> > Sent: Sunday, November 25, 2001 8:32 PM
> > To: xxxxx@lists.osr.com
> > Subject: [ntdev] IM driver uninstall issue.
> >
> > A quick question about the uninstall of an NDIS intermediate driver. I’ve
> >
> > written such a driver based on the “Writing an NDIS intermediate driver”
> > article at msdn. The problem is that when I uninstall the driver from the
> >
> > Network Connection properties page, it hangs in
> > NdisIMDeInitializeDeviceInstance() for about 7 minutes before calling my
> > MiniportHalt() function and then returning success and unloading properly.
> >
> > I don’t believe I am doing anything wrong, but I can’t figure out why this
> >
> > pauses for so long.
> >
> > The odd thing is that sometimes it returns immediately, but mostly it will
> >
> > hang for some time. It’s a bit annoying as it slows down development and
> > testing.
> >
> > This problem was also mentioned in february by xxxxx@necas.nec.co.jp
> > (“about NdisIMDeInitializeDeviceInstance”), but I didn’t see any answers
> > to
> > the issue.
> >
> > I have also compiled the MS passthru driver, and it exhibits the same
> > behavior.
> >
> > This is on Win2k/SP2 with the Win2k ddk.
> >
> > Any ideas?
> >
> > TIA,
> > fes
> >
> > —
> > You are currently subscribed to ntdev as: michal.vodicka@st.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
> —
> You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

One more note: we uninstall our driver using a setup and I wrote a helper
DLL which performs it using SetupDi function. The DLL disables all adapters
before uninstall and IIRC it was necessary to avoid some problems. It is
possible that one of problems was the long timeout. Queued packet problems
may be unrelated to your current problem. Try a quick test: disable all
adapters by hand and see if driver unloads immediatelly.

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]


From: xxxxx@digitalheroin.net[SMTP:xxxxx@digitalheroin.net]
Reply To: xxxxx@lists.osr.com
Sent: Monday, November 26, 2001 2:53 PM
To: xxxxx@lists.osr.com
Subject: [ntdev] RE: IM driver uninstall issue.

That sounds like a pretty good idea. Right now I’ve just been
uninstalling, and then using the SCManager to remove the image from
memory.
Simply disabling and then re-enabling the devices should be much faster.

And since removing the IM driver effectively kills of connections anyway,
it shouldn’t cause any unnecessary problems.

As for the delay, I did try replacing MiniportSend, ProtocolReceivePacket,

etc., with functions that just returned the packet rather than processing
it, which would mean that there should never be an outstanding packet
request to test that scenario. However, I still got the delay. Though if

you don’t get such a delay in your driver, it must be something in common
between my driver and the passthru.

Thanks for the advice. I’ll implement similar functionality and see if
that helps.

fes

On 11/26/01, “Michal Vodicka ” wrote:
> > Hmm, it seems you don’t really need uninstall but reload driver instead.
> > IIRC there were problems with real uninstalls (driver image remains in
> > memory or something like this). OS unloads your driver when you disable
> all
> > your devices and loads it back when devices are re-enabled. You can do
> it
> > using GUI (slow) or write an app which performs it automatically (see
> w2k
> > DDK enable example [src\general\setup\Enable]). I successfully developed
> w2k
> > NDIS filter driver this way with almost no reboot. Note if your driver
> is
> > creating extra devices using NdisMRegisterDevice, above may not work if
> > devices exist after all adapters are disabled. I solved this problems
> > creating devices in MiniportInitialize and destroying them in
> MiniportHalt.
> >
> > As for long waiting, it may be caused by outstanding packets. Ensure
> that
> > beforre calling NdisIMDeinitializeDeviceInstance all queued packets are
> > completed (probably including these sent to below driver). NDIS
> references
> > you miniport context when a packet is sent and dereferences when
> completed.
> > It doesn’t call MiniportHalt until reference count is zero. Maybe there
> is
> > some timeout, I can’t remember.
> >
> > Best regards,
> >
> > Michal Vodicka
> > STMicroelectronics Design and Application s.r.o.
> > [michal.vodicka@st.com, http:://www.st.com]
> >
> > > ----------
> > > From: xxxxx@digitalheroin.net[SMTP:xxxxx@digitalheroin.net]
> > > Reply To: xxxxx@lists.osr.com
> > > Sent: Sunday, November 25, 2001 8:32 PM
> > > To: xxxxx@lists.osr.com
> > > Subject: [ntdev] IM driver uninstall issue.
> > >
> > > A quick question about the uninstall of an NDIS intermediate driver.
> I’ve
> > >
> > > written such a driver based on the “Writing an NDIS intermediate
> driver”
> > > article at msdn. The problem is that when I uninstall the driver from
> the
> > >
> > > Network Connection properties page, it hangs in
> > > NdisIMDeInitializeDeviceInstance() for about 7 minutes before calling
> my
> > > MiniportHalt() function and then returning success and unloading
> properly.
> > >
> > > I don’t believe I am doing anything wrong, but I can’t figure out why
> this
> > >
> > > pauses for so long.
> > >
> > > The odd thing is that sometimes it returns immediately, but mostly it
> will
> > >
> > > hang for some time. It’s a bit annoying as it slows down development
> and
> > > testing.
> > >
> > > This problem was also mentioned in february by xxxxx@necas.nec.co.jp
> > > (“about NdisIMDeInitializeDeviceInstance”), but I didn’t see any
> answers
> > > to
> > > the issue.
> > >
> > > I have also compiled the MS passthru driver, and it exhibits the same
> > > behavior.
> > >
> > > This is on Win2k/SP2 with the Win2k ddk.
> > >
> > > Any ideas?
> > >
> > > TIA,
> > > fes
> > >
> > > —
> > > You are currently subscribed to ntdev as: michal.vodicka@st.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> > —
> > You are currently subscribed to ntdev as: michal.vodicka@st.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: michal.vodicka@st.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com