Author: tfaber
Date: Sun Jun 18 20:10:44 2017
New Revision: 75104

URL: http://svn.reactos.org/svn/reactos?rev=75104&view=rev
Log:
[NTOS:MM]
- Directly pass the file object to MmCreateDataFileSection

Modified:
    trunk/reactos/ntoskrnl/mm/section.c

Modified: trunk/reactos/ntoskrnl/mm/section.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=75104&r1=75103&r2=75104&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Sun Jun 18 20:10:44 2017
@@ -2898,7 +2898,7 @@
                         PLARGE_INTEGER UMaximumSize,
                         ULONG SectionPageProtection,
                         ULONG AllocationAttributes,
-                        HANDLE FileHandle)
+                        PFILE_OBJECT FileObject)
 /*
  * Create a section backed by a data file
  */
@@ -2906,9 +2906,7 @@
     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 @@
                             (PVOID*)&Section);
     if (!NT_SUCCESS(Status))
     {
+        ObDereferenceObject(FileObject);
         return(Status);
     }
     /*
@@ -2936,22 +2935,6 @@
     Section->Size = 'TN';
     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
@@ -5132,9 +5115,7 @@
                                           MaximumSize,
                                           SectionPageProtection,
                                           AllocationAttributes,
-                                          FileHandle);
-        if (FileObject)
-            ObDereferenceObject(FileObject);
+                                          FileObject);
     }
 #else
     else if (FileHandle != NULL || FileObject != NULL)


Reply via email to