[NTOS:MM] VirtualSize overrides SizeOfRawData when mapping PE files. CORE-17284

This fixes the related failures in ntdll_apitest:NtMapViewOfSection
as well as loading of OrgPlayer's DragDrop.ocx.
This commit is contained in:
Thomas Faber 2020-09-27 16:43:19 +02:00
parent 9b1fb8d6fd
commit b957af4b6b
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -754,7 +754,7 @@ l_ReadHeaderFromFile:
pssSegments[i].Protection = SectionCharacteristicsToProtect[nCharacteristics >> 28];
pssSegments[i].WriteCopy = !(nCharacteristics & IMAGE_SCN_MEM_SHARED);
if(pishSectionHeaders[i].Misc.VirtualSize == 0 || pishSectionHeaders[i].Misc.VirtualSize < pishSectionHeaders[i].SizeOfRawData)
if(pishSectionHeaders[i].Misc.VirtualSize == 0)
pssSegments[i].Length.QuadPart = pishSectionHeaders[i].SizeOfRawData;
else
pssSegments[i].Length.QuadPart = pishSectionHeaders[i].Misc.VirtualSize;