Author: cgutman
Date: Wed May  6 03:43:18 2009
New Revision: 40806
URL: 
http://svn.reactos.org/svn/reactos?rev=40806&view=rev
Log:
 - Register the unload handler so it gets called by NDIS
Modified:
    trunk/reactos/drivers/network/tcpip/datalink/lan.c
    trunk/reactos/drivers/network/tcpip/include/lan.h
Modified: trunk/reactos/drivers/network/tcpip/datalink/lan.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/data…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] Wed May  6 03:43:18
2009
@@ -1264,6 +1264,42 @@
     FreeAdapter(Adapter);
     return NdisStatus;
+}
+
+VOID
+NTAPI
+LANUnregisterProtocol(VOID)
+/*
+ * FUNCTION: Unregisters this protocol driver with NDIS
+ * NOTES: Does not care wether we are already registered
+ */
+{
+    TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
+
+    if (ProtocolRegistered) {
+        NDIS_STATUS NdisStatus;
+        PLIST_ENTRY CurrentEntry;
+        PLIST_ENTRY NextEntry;
+        PLAN_ADAPTER Current;
+        KIRQL OldIrql;
+
+        TcpipAcquireSpinLock(&AdapterListLock, &OldIrql);
+
+        /* Search the list and remove every adapter we find */
+        CurrentEntry = AdapterListHead.Flink;
+        while (CurrentEntry != &AdapterListHead) {
+            NextEntry = CurrentEntry->Flink;
+            Current = CONTAINING_RECORD(CurrentEntry, LAN_ADAPTER, ListEntry);
+            /* Unregister it */
+            LANUnregisterAdapter(Current);
+            CurrentEntry = NextEntry;
+        }
+
+        TcpipReleaseSpinLock(&AdapterListLock, OldIrql);
+
+        NdisDeregisterProtocol(&NdisStatus, NdisProtocolHandle);
+        ProtocolRegistered = FALSE;
+    }
 }
 VOID
@@ -1315,6 +1351,7 @@
     ProtChars.BindAdapterHandler             = ProtocolBindAdapter;
     ProtChars.PnPEventHandler                = ProtocolPnPEvent;
     ProtChars.UnbindAdapterHandler           = ProtocolUnbindAdapter;
+    ProtChars.UnloadHandler                  = LANUnregisterProtocol;
     /* Try to register protocol */
     NdisRegisterProtocol(&NdisStatus,
@@ -1332,40 +1369,4 @@
     return STATUS_SUCCESS;
 }
-
-VOID LANUnregisterProtocol(
-    VOID)
-/*
- * FUNCTION: Unregisters this protocol driver with NDIS
- * NOTES: Does not care wether we are already registered
- */
-{
-    TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
-
-    if (ProtocolRegistered) {
-        NDIS_STATUS NdisStatus;
-        PLIST_ENTRY CurrentEntry;
-        PLIST_ENTRY NextEntry;
-        PLAN_ADAPTER Current;
-        KIRQL OldIrql;
-
-        TcpipAcquireSpinLock(&AdapterListLock, &OldIrql);
-
-        /* Search the list and remove every adapter we find */
-        CurrentEntry = AdapterListHead.Flink;
-        while (CurrentEntry != &AdapterListHead) {
-            NextEntry = CurrentEntry->Flink;
-            Current = CONTAINING_RECORD(CurrentEntry, LAN_ADAPTER, ListEntry);
-            /* Unregister it */
-            LANUnregisterAdapter(Current);
-            CurrentEntry = NextEntry;
-        }
-
-        TcpipReleaseSpinLock(&AdapterListLock, OldIrql);
-
-        NdisDeregisterProtocol(&NdisStatus, NdisProtocolHandle);
-        ProtocolRegistered = FALSE;
-    }
-}
-
 /* EOF */
Modified: trunk/reactos/drivers/network/tcpip/include/lan.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/lan.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/include/lan.h [iso-8859-1] Wed May  6 03:43:18
2009
@@ -92,8 +92,8 @@
 NTSTATUS LANRegisterProtocol(
     PNDIS_STRING Name);
-VOID LANUnregisterProtocol(
-    VOID);
+VOID NTAPI
+LANUnregisterProtocol(VOID);
 VOID LANStartup();
 VOID LANShutdown();