- 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.

svn path=/trunk/; revision=41885
This commit is contained in:
Michael Martin 2009-07-11 13:40:56 +00:00
parent fad802aace
commit 6181543561

View file

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