Share via


[Optional] Registering Callback Routines

Note

For optimal reliability and performance, use file system minifilter drivers with Filter Manager support instead of legacy file system filter drivers. To port your legacy driver to a minifilter driver, see Guidelines for Porting Legacy Filter Drivers.

Legacy filter drivers can call IoRegisterFsRegistrationChange to register a callback routine to be called whenever a file system driver calls IoRegisterFileSystem or IoUnregisterFileSystem to register or unregister itself. Filter drivers register this callback routine so they can see new file systems enter the system and choose whether to attach to them.

File system filter drivers must never call IoRegisterFileSystem or IoUnregisterFileSystem. These routines are only for file systems.

Filter drivers that attach to volumes only when explicitly directed (for example, by a user-mode application) shouldn't call IoRegisterFsRegistrationChange. Note, however, that a filter that uses this routine has the ability to attach to any given volume immediately after that volume is mounted. Using this routine doesn't guarantee that the filter attaches directly to the volume device object. It does ensure that such a filter attaches before (and thus below) any filter that instead waits for a command from a user-mode application. This is because filters can attach only at the top of the current file system volume device stack.