From 1ee7db3ccc98b2ed4fab41c8b74efe401c2ea8a6 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sun, 18 Jun 2017 20:10:44 +0000 Subject: [PATCH] [NTOS:MM] - Directly pass the file object to MmCreateDataFileSection svn path=/trunk/; revision=75104 --- reactos/ntoskrnl/mm/section.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 4bfb793ddc7..1b679fd224e 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -2898,7 +2898,7 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject, PLARGE_INTEGER UMaximumSize, ULONG SectionPageProtection, ULONG AllocationAttributes, - HANDLE FileHandle) + PFILE_OBJECT FileObject) /* * Create a section backed by a data file */ @@ -2906,9 +2906,7 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject, PROS_SECTION_OBJECT Section; NTSTATUS Status; LARGE_INTEGER MaximumSize; - PFILE_OBJECT FileObject; PMM_SECTION_SEGMENT Segment; - ULONG FileAccess; FILE_STANDARD_INFORMATION FileInfo; ULONG Length; @@ -2926,6 +2924,7 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject, (PVOID*)&Section); if (!NT_SUCCESS(Status)) { + ObDereferenceObject(FileObject); return(Status); } /* @@ -2937,22 +2936,6 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject, Section->SectionPageProtection = SectionPageProtection; Section->AllocationAttributes = AllocationAttributes; - /* - * Reference the file handle - */ - FileAccess = MiArm3GetCorrectFileAccessMask(SectionPageProtection); - Status = ObReferenceObjectByHandle(FileHandle, - FileAccess, - IoFileObjectType, - ExGetPreviousMode(), - (PVOID*)(PVOID)&FileObject, - NULL); - if (!NT_SUCCESS(Status)) - { - ObDereferenceObject(Section); - return(Status); - } - /* * FIXME: This is propably not entirely correct. We can't look into * the standard FCB header because it might not be initialized yet @@ -5132,9 +5115,7 @@ MmCreateSection (OUT PVOID * Section, MaximumSize, SectionPageProtection, AllocationAttributes, - FileHandle); - if (FileObject) - ObDereferenceObject(FileObject); + FileObject); } #else else if (FileHandle != NULL || FileObject != NULL) -- 2.17.1