From d7e92f7b85ed88b4bcd8b4bb4a5dd7644ddfdbac Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Fri, 12 Dec 2003 05:27:58 +0000 Subject: [PATCH] In NDIS 5.1 miniport drivers, the shutdown handler function pointer is provided to NDIS via the the miniport characteristics structure supplied in the call to NdisMRegisterMiniport(). But in NDIS 5.0 and earlier, you had to call NdisMRegisterAdapterShutdownHandler() and supply both a function pointer and context pointer. We try to handle both cases in ndis_shutdown_nic(). If the driver registered a shutdown routine and a context,then used that context, otherwise pass it the adapter context from NdisMSetAttributesEx(). This fixes a panic on shutdown with the sample Intel 82559 e100bex.sys driver from the Windows DDK. function pointer --- sys/compat/ndis/kern_ndis.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c index b36831f17ce1..0433f7dac949 100644 --- a/sys/compat/ndis/kern_ndis.c +++ b/sys/compat/ndis/kern_ndis.c @@ -770,7 +770,10 @@ ndis_shutdown_nic(arg) if (shutdownfunc == NULL) return(EINVAL); - shutdownfunc(sc->ndis_chars.nmc_rsvd0); + if (sc->ndis_chars.nmc_rsvd0 == NULL) + shutdownfunc(adapter); + else + shutdownfunc(sc->ndis_chars.nmc_rsvd0); return(0); }