[The information below has also been added to the Windows 2000 IFS Kit
Errata list, which can be found at
http://www.microsoft.com/hwdev/ntifskit/errata.htm.]
A bug has recently been found and corrected in the SFilter sample. If your
file system filter driver was based on SFilter, you should make the same
changes to your own driver code. Following is a complete description of the
bug and the corrected code.
Dispatch routines should always use IoCopyCurrentIrpStackLocationToNext or
IoSkipCurrentStackLocation to copy the contents of the current IRP stack
location to that of the next-lower driver on the stack.
IoCopyCurrentIrpStackLocationToNext allows the current driver to set an I/O
completion routine; IoSkipCurrentStackLocation does not.
Drivers should never copy stack locations manually. Driver Verifier now
checks for this error. SFilter copied stack locations manually (and
incorrectly). Thus the following code has been changed wherever it occurs in
SFilter’s dispatch routines (all of which are defined in the file
sfilter.c):
-
The following lines:
PIO_STACK_LOCATION nextIrpSp;
irpSp = IoGetCurrentIrpStackLocation( Irp );
nextIrpSp = IoGetNextIrpStackLocation( Irp );
RtlMoveMemory( nextIrpSp, irpSp, sizeof( IO_STACK_LOCATION ) );
have been changed to:
IoCopyCurrentIrpStackLocationToNext( Irp );
in the following routines:
SfPassThrough (comment only)
SfCreate (1 occurrence)
SfFsControl (2 occurrences) -
The following lines:
Irp->CurrentLocation++;
Irp->Tail.Overlay.CurrentStackLocation++;
have been changed to:
IoSkipCurrentIrpStackLocationToNext( Irp );
in the following routines:
SfCreate (1 occurrence)
SfCleanupClose (1 occurrence)
SfFsControl (2 occurrences)