[NTOS:MM]

- Directly pass the file object to MmCreateDataFileSection

svn path=/trunk/; revision=75104
This commit is contained in:
Thomas Faber 2017-06-18 20:10:44 +00:00
parent 220e2a29b0
commit 1ee7db3ccc

View file

@ -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)