Hi, all,
I have problem with non-cached writes when testing our file system
filter under Windows 2003 server.
Let’s test a simple situation - I copy an example file (Winnt.h)
from E:\Test\SubDir1\Winnt.h to E:\Winnt.h.
When the cache manager writes the target file to disk,
our filter catches non-cached IRP_MJ_WRITE for the purpose
of data encryption. In this case, the filter doesn’t
modify the data.
The first write if at offset 0, length 0x10000 (65535 bytes).
It is a MDL write with system buffer at 0xEE189000:
:db EE189000
0010:EE189000 2F 2A 2B 2B 20 42 55 49-4C 44 20 56 65 72 73 69 /*++ BUILD
Versi
0010:EE189010 6F 6E 3A 20 30 30 38 32-20 20 20 20 20 49 6E 63 on: 0082
Inc
0010:EE189020 72 65 6D 65 6E 74 20 74-68 69 73 20 69 66 20 61 rement this
if a
Our filter copies the stack location to next with changing
the file object. After calling lower driver (NTFS.sys),
STATUS_SUCCESS is returned, (the same value is in Irp->IoStatus),
but Irp->IoStatus.Information contains zero.
The cached write is really not completed, which
can be assured after system restart (the file is filled by zeros).
The goal is, that this approach works well on NT4.0, 2000, XP SP1,
but not on Windows 2003. I examined the listings for XPSP1 and 2003,
they were the same (except for pointers, of course).
The bug occurs on NTFS only, (On FASTFAT or redirectors works
well)
Can anyone from Microsoft give me a hint what is wrong ?
Here comes the IRP listing from Soft-ICE. First is the Irp, then the
original file object, then the changed file object.
*** Irp ***
MdlAddress * : F9CA8B80
Flags : 00000043 IRP_NOCACHE | IRP_PAGING_IO |
IRP_MOUNT_COMPLETION | IRP_INPUT_OPERATION |
IRP_SYNCHRONOUS_PAGING_IO
AssociatedIrp : 00000000
&ThreadListEntry : FF4E2448
IoStatus.Status : 00000000
IoStatus.Information : 00000000
RequestorMode : 00
PendingReturned : False
StackCount : 09
CurrentLocation : 09
Cancel : False
CancelIrql : 00
ApcEnvironment : 00
UserIosb * : F9CA8D50
UserEvent * : F9CA8BF0
Overlay : 00000000 00000000
CancelRoutine * : 00000000
UserBuffer * : 00000000
Tail.Overlay
&DeviceQueueEntry : FF4E2478
Thread * : 823CB610
AuxiliaryBuffer * : 00000000
&ListEntry : FF4E2490
CurrentStackLoc * : FF4E25C8
OrigFileObject * : FF7E1680
Tail.Apc * : FF4E2478
Tail.ComplKey : 00000000
CurrentStackLocation at FF4E25C8:
MajorFunction : 04 IRP_MJ_WRITE
MinorFunction : 00
Control : 00
Flags : 00
Length : 00010000
Key : 00000000
ByteOffset : 00
DeviceObject * : 822E93C8
FileObject * : FF7E1680
CompletionRout * : 00000000
Context * : 00000000
*** Original file object ***
:fobj FF7E1680
DeviceObject * : 82356040
Vpb * : 82399770
FsContext * : E1E2F008
FsContext2 * : E185C510
SecObjPointer * : FF49B728
PrivateCacheMap * : 00000000
FinalStatus : 00000000
RelatedFileObj * : 00000000
LockOperation : False
DeletePending : False
ReadAccess : True
WriteAccess : True
DeleteAccess : False
SharedRead : True
SharedWrite : True
SharedDelete : False
Flags : 00044062 FO_SYNCHRONOUS_IO | FO_SEQUENTIAL_ONLY |
FO_CACHE_SUPPORTED | FO_CLEANUP_COMPLETE |
FO_HANDLE_CREATED
FileName : \WinNT.h
CurrentByteOffset : 049383
Waiters : 00000000
Busy : 00000000
LastLock* : 00000000
&Lock : FF7E16CC
&Event : FF7E16DC
ComplContext* : 00000000
*** Changed file object ***
:fobj FF7E19F0
DeviceObject * : 82356040
Vpb * : 82399770
FsContext * : E1D45D90
FsContext2 * : E1D45EE8
SecObjPointer * : FF4CAA54
PrivateCacheMap * : 00000000
FinalStatus : 00000000
RelatedFileObj * : 00000000
LockOperation : False
DeletePending : False
ReadAccess : True
WriteAccess : True
DeleteAccess : False
SharedRead : True
SharedWrite : True
SharedDelete : False
Flags : 00044028 FO_NO_INTERMEDIATE_BUFFERING |
FO_SEQUENTIAL_ONLY | FO_CLEANUP_COMPLETE | FO_HANDLE_CREATED
FileName : \WinNT.h
CurrentByteOffset : 00
Waiters : 00000000
Busy : 00000000
LastLock* : 00000000
&Lock : FF7E1A3C
&Event : FF7E1A4C
ComplContext* : 00000000
L.