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=…
==============================================================================
--- 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,