Previous Next

ProtocolUnload

The ProtocolUnload function is optional. ProtocolUnload performs cleanup operations before a protocol is unloaded.

VOID
  ProtocolUnload(
    VOID
    );

Headers

Declared in Ndis.h. Include Ndis.h.

Comments

In response to a user request to uninstall a protocol, NDIS calls a protocol's ProtocolUnload function if the protocol has registered an entry point for this function in the NDIS_PROTOCOL_CHARACTERISTICS structure that it passed to NdisRegisterProtocol. NDIS calls ProtocolUnload after calling the protocol's ProtocolUnbindAdapter function once for each bound adapter.

ProtocolUnload performs driver-determined cleanup operations. For example, ProtocolUnload could request clients to close handles that they have opened to device objects exported by the protocol. Until all such handles are closed, the I/O Manager will not call the DriverUnload function that the protocol registered in the driver object passed to its DriverEntry function. After all the handles are closed, ProtocolUnload could call IoDeleteDevice one or more times to delete device objects created by the protocol.

ProtocolUnload does not have to close a protocol's open bindings. When a protocol's DriverUnload function calls NdisDeregisterProtocol, NDIS calls the protocol's ProtocolUnbindAdapter function once for each binding that the protocol has open. The ProtocolUnbindAdapter function calls NdisCloseAdapter to close the binding.

ProtocolUnload must be written so that it can run at IRQL = PASSIVE_LEVEL.

See Also

DriverEntry of NDIS Protocol Drivers, IoDeleteDevice, ProtocolUnbindAdapter