- Register the unload handler so it gets called by NDIS

svn path=/trunk/; revision=40806
This commit is contained in:
Cameron Gutman 2009-05-05 23:43:18 +00:00
parent bc49f505ef
commit 816a0d3ae7
2 changed files with 39 additions and 38 deletions

View file

@ -1266,6 +1266,42 @@ NDIS_STATUS LANUnregisterAdapter(
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
NTAPI
ProtocolUnbindAdapter(
@ -1315,6 +1351,7 @@ NTSTATUS LANRegisterProtocol(
ProtChars.BindAdapterHandler = ProtocolBindAdapter;
ProtChars.PnPEventHandler = ProtocolPnPEvent;
ProtChars.UnbindAdapterHandler = ProtocolUnbindAdapter;
ProtChars.UnloadHandler = LANUnregisterProtocol;
/* Try to register protocol */
NdisRegisterProtocol(&NdisStatus,
@ -1332,40 +1369,4 @@ NTSTATUS LANRegisterProtocol(
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 */

View file

@ -92,8 +92,8 @@ NDIS_STATUS LANUnregisterAdapter(
NTSTATUS LANRegisterProtocol(
PNDIS_STRING Name);
VOID LANUnregisterProtocol(
VOID);
VOID NTAPI
LANUnregisterProtocol(VOID);
VOID LANStartup();
VOID LANShutdown();