Properly reset FCB & SectionObjectPointer fields from the FileObject on close

svn path=/trunk/; revision=64691
This commit is contained in:
Pierre Schweitzer 2014-10-12 11:43:10 +00:00
parent 64e2bc0bcd
commit c440495495

View file

@ -42,12 +42,14 @@ NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject) PFILE_OBJECT FileObject)
{ {
PNTFS_CCB Ccb; PNTFS_CCB Ccb;
PNTFS_FCB Fcb;
DPRINT("NtfsCloseFile(DeviceExt %p, FileObject %p)\n", DPRINT("NtfsCloseFile(DeviceExt %p, FileObject %p)\n",
DeviceExt, DeviceExt,
FileObject); FileObject);
Ccb = (PNTFS_CCB)(FileObject->FsContext2); Ccb = (PNTFS_CCB)(FileObject->FsContext2);
Fcb = (PNTFS_FCB)(FileObject->FsContext);
DPRINT("Ccb %p\n", Ccb); DPRINT("Ccb %p\n", Ccb);
if (Ccb == NULL) if (Ccb == NULL)
@ -56,13 +58,15 @@ NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
} }
FileObject->FsContext2 = NULL; FileObject->FsContext2 = NULL;
FileObject->FsContext = NULL;
FileObject->SectionObjectPointer = NULL;
if (FileObject->FileName.Buffer) if (FileObject->FileName.Buffer)
{ {
// This a FO, that was created outside from FSD. // This a FO, that was created outside from FSD.
// Some FO's are created with IoCreateStreamFileObject() insid from FSD. // Some FO's are created with IoCreateStreamFileObject() insid from FSD.
// This FO's don't have a FileName. // This FO's don't have a FileName.
NtfsReleaseFCB(DeviceExt, FileObject->FsContext); NtfsReleaseFCB(DeviceExt, Fcb);
} }
if (Ccb->DirectorySearchPattern) if (Ccb->DirectorySearchPattern)