HI,
I’m deveoping a realtime file moniter using minifilter,i use
FsRtlCreateSectionForDataScan in the PostCreate callback like this:
status = FsRtlCreateSectionForDataScan(&hSection,
&secObject,
&lsize,
FltObjects->FileObject,
SECTION_MAP_READ,
NULL,
NULL,
PAGE_READONLY,
SEC_COMMIT,
0);
if(NT_SUCCESS(status))
{
//ZwClose(hSection);
ObDereferenceObject(secObject);
// hSection=0;
DbgPrint(“FsRtlCreateSectionForDataScan Successfully!!!\n”);
}
else
{
if(status!=STATUS_END_OF_FILE)
DbgPrint(“FsRtlCreateSectionForDataScan Failed in PostCreate
status=%x!!!\n”,status);
//goto __Cleanup;
}
KeUnstackDetachProcess(&apcState);
this code works fine on NTFS,but when some file access happens on FAT32,it
will crash the kernel,the stack is here:
STACK_TEXT:
f8ac4888 804f89f7 00000003 f8ac4be4 00000000
nt!RtlpBreakWithStatusInstruction
f8ac48d4 804f95e4 00000003 00000000 f5cfaca0 nt!KiBugCheckDebugBreak+0x19
f8ac4cb4 804f9b0f 000000c2 00000007 00000cd4 nt!KeBugCheck2+0x574
f8ac4cd4 80544f06 000000c2 00000007 00000cd4 nt!KeBugCheckEx+0x1b
f8ac4d24 805b66db f5cfaca8 e56c6946 823ea090 nt!ExFreePoolWithTag+0x2a0
f8ac4d48 805b08a7 00000000 f5cfacc0 823b78b8 nt!ObpFreeObject+0x18d
f8ac4d60 805b0d5a f5cfacc0 00000001 80559ba0 nt!ObpRemoveObjectRoutine+0xe7
f8ac4d74 8053500e 00000000 00000000 823b78b8
nt!ObpProcessRemoveObjectQueue+0x38
f8ac4dac 805c5d5e 00000000 00000000 00000000 nt!ExpWorkerThread+0x100
f8ac4ddc 805421f2 80534f0e 00000000 00000000 nt!PspSystemThreadStartup+0x34
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16
the reason i use FsRtlCreateSectionForDataScan is that i don’t want to
reopen the file,Do someone knows why this happen???Thanks!!!