diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index ddb4960a1e0..b52795d22a7 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -3729,6 +3729,7 @@ NtMapViewOfSection(IN HANDLE SectionHandle, PMMSUPPORT AddressSpace; NTSTATUS Status = STATUS_SUCCESS; ULONG tmpProtect; + ACCESS_MASK DesiredAccess; /* * Check the protection @@ -3807,8 +3808,27 @@ NtMapViewOfSection(IN HANDLE SectionHandle, 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,