Detaching a Filter Module

To initiate the process of detaching a filter module from a driver stack, NDIS calls a filter driver's FilterDetach function. At the start of execution in the FilterDetach function, the filter module enters the Detached state. Before detaching a filter module, NDIS must pause the driver stack. For more information about pausing the driver stack, see Pausing a Driver Stack.

In its FilterDetach function, the driver frees its context areas and other resources (such as buffer pools) for the affected filter module. A filter driver cannot fail the call to FilterDetach. Therefore, filter drivers should preallocate, during the attach operation, all the resources required to perform the detach operation successfully. For more information about attaching a filter module, see Attaching a Filter Module.

After the filter module returns from FilterDetach, NDIS can start the paused driver stack. For more information about starting a driver stack, see Starting a Driver Stack.