[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-10-03 13:13:35 +02:00
parent 9b1fb8d6fd
commit b957af4b6b
+1 -1
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;