IoRegisterFsRegistrationChange function

The IoRegisterFsRegistrationChange routine registers a file system filter driver's notification routine to be called whenever a file system registers or unregisters itself as an active file system.


NTSTATUS IoRegisterFsRegistrationChange(
  PDRIVER_OBJECT          DriverObject,
  PDRIVER_FS_NOTIFICATION DriverNotificationRoutine



Pointer to the driver object for the file system filter driver.


A pointer to the PDRIVER_FS_NOTIFICATION routine, which the file system calls when it registers or unregisters itself.

Return Value

Return code Description
The notification routine was successfully registered.
A notification packet could not be allocated for the notification routine.


IoRegisterFsRegistrationChange registers a file system filter driver to be notified whenever a file system calls IoRegisterFileSystem or IoUnregisterFileSystem.

To stop receiving such notifications, the filter driver should call IoUnregisterFsRegistrationChange.

Note   In Microsoft Windows XP and later, when a file system filter driver calls IoRegisterFsRegistrationChange, its notification routine is also called immediately for all currently registered file systems (that is, file systems that have already called IoRegisterFileSystem but have not yet called IoUnregisterFileSystem).

Because the caller's notification routine can be called even before IoRegisterFsRegistrationChange returns, a filter driver should not call this routine until after it has created any data structures that it needs in order to process these notifications.

Additionally, in Windows XP and later, IoRegisterFsRegistrationChange ignores RAW devices. For information about attaching to the RAW file system by name, see Attaching the Filter Device Object to the Target Device Object.

IoRegisterFsRegistrationChange increments the reference count on the filter driver's driver object.
Note   In Update Rollup for Windows 2000 Service Pack 4 (SP4), Windows XP Service Pack 2 (SP2), and Microsoft Windows Server 2003 SP1 and later, if a file system filter driver calls IoRegisterFsRegistrationChange twice in succession (without calling IoUnregisterFsRegistrationChange in between), passing the same values for the DriverObject and DriverNotificationRoutine that it registered in the previous call to IoRegisterFsRegistrationChange, and no other filter drivers have registered since the first call, IoRegisterFsRegistrationChange returns STATUS_DEVICE_ALREADY_ATTACHED.
In Update Rollup for Windows 2000 SP4, file system filter drivers can call IoRegisterFsRegistrationChangeEx instead of IoRegisterFsRegistrationChange. The effect of IoRegisterFsRegistrationChangeEx is identical to that of IoRegisterFsRegistrationChange on Windows XP and later.


Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe

See Also