Add Miniport Driver Unload Functionality for NDIS 6.0 (Compact 7)
3/12/2014
NDIS 6.0 miniport drivers must provide a MiniportDriverUnload entry point function that NDIS calls to request your miniport driver to release resources before the system completes a driver unload operation.
To update miniport driver unload functionality for NDIS 6.0
Register your MiniportDriverUnload function in the miniport driver characteristics structure.
NDIS 6.0 miniport drivers do not call NdisMRegisterUnloadHandler to register an unload function. Instead, NDIS 6.0 miniport drivers specify the MiniportDriverUnload function in the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure (for more information about this structure, see Initialize the Miniport Driver Characteristics Structure).
Call NdisMDeregisterMiniportDriver in your MiniportDriverUnload function.
In NDIS 6.0, your MiniportDriverUnload function must call the NdisMDeregisterMiniportDriver function to unregister the miniport driver. Your call to NdisMDeregisterMiniportDriver passes the handle that you obtained when you called the NdisMRegisterMiniportDriver function, as explained in Convert Miniport Driver Initialization for NDIS 6.0.
The following example illustrates a miniport driver unload function that simply calls NdisMDeregisterMiniportDriver and returns:
VOID MyMiniportDriverUnload (IN PDRIVER_OBJECT DriverObject)
{
NdisMDeregisterMiniportDriver(NdisMiniportDriverHandle);
}
In the preceding example, NdisMiniportDriverHandle
is the driver handle that NdisMRegisterMiniportDriver returned during driver initialization.