[ros-diffs] [mjmartin] 41885: - NtMapViewOfSection: When referencing the section object by handle, don't assume access mask of SECTION_MAP_READ. Access mask must be determined from page protection attributes passed in Protect parameter. Fixes 5 winetests for kernel32 virtual.

mjmartin at svn.reactos.org mjmartin at svn.reactos.org
Sat Jul 11 15:40:57 CEST 2009


Author: mjmartin
Date: Sat Jul 11 17:40:56 2009
New Revision: 41885

URL: http://svn.reactos.org/svn/reactos?rev=41885&view=rev
Log:
- NtMapViewOfSection: When referencing the section object by handle, don't assume access mask  of SECTION_MAP_READ. Access mask must be determined from page protection attributes passed in Protect parameter. Fixes 5 winetests for kernel32 virtual.

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=41885&r1=41884&r2=41885&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Sat Jul 11 17:40:56 2009
@@ -3729,6 +3729,7 @@
    PMMSUPPORT AddressSpace;
    NTSTATUS Status = STATUS_SUCCESS;
    ULONG tmpProtect;
+   ACCESS_MASK DesiredAccess;
 
    /*
     * Check the protection
@@ -3807,8 +3808,27 @@
 
    AddressSpace = &Process->Vm;
 
+   /* Convert NT Protection Attr to Access Mask */
+   if (Protect == PAGE_READONLY)
+   {
+      DesiredAccess = SECTION_MAP_READ;
+   }
+   else if (Protect == PAGE_READWRITE)
+   {
+      DesiredAccess = SECTION_MAP_WRITE;
+   }
+   else if (Protect == PAGE_WRITECOPY)
+   {
+      DesiredAccess = SECTION_QUERY;
+   }
+   /* FIXME: Handle other Protection Attributes. For now keep previous behavior */
+   else
+   {
+      DesiredAccess = SECTION_MAP_READ;
+   }
+
    Status = ObReferenceObjectByHandle(SectionHandle,
-                                      SECTION_MAP_READ,
+                                      DesiredAccess,
                                       MmSectionObjectType,
                                       PreviousMode,
                                       (PVOID*)(PVOID)&Section,



More information about the Ros-diffs mailing list