[NTOSKRNL] Ignore IMAGE_SCN_CNT_UNINITIALIZED_DATA

CORE-12582
CORE-14556
This commit is contained in:
Mark Jansen 2018-04-19 21:58:09 +02:00
parent ffa94ca0f0
commit c7eb46d9fd

View file

@ -684,7 +684,7 @@ l_ReadHeaderFromFile:
pssSegments[0].Length.QuadPart = nPrevVirtualEndOfSegment; pssSegments[0].Length.QuadPart = nPrevVirtualEndOfSegment;
pssSegments[0].RawLength.QuadPart = nFileSizeOfHeaders; pssSegments[0].RawLength.QuadPart = nFileSizeOfHeaders;
pssSegments[0].Image.VirtualAddress = 0; pssSegments[0].Image.VirtualAddress = 0;
pssSegments[0].Image.Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA; pssSegments[0].Image.Characteristics = 0;
pssSegments[0].WriteCopy = TRUE; pssSegments[0].WriteCopy = TRUE;
/* skip the headers segment */ /* skip the headers segment */
@ -1365,7 +1365,7 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
HasSwapEntry = MmIsPageSwapEntry(Process, Address); HasSwapEntry = MmIsPageSwapEntry(Process, Address);
/* See if we should use a private page */ /* See if we should use a private page */
if ((HasSwapEntry) || (Segment->Image.Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)) if (HasSwapEntry)
{ {
SWAPENTRY DummyEntry; SWAPENTRY DummyEntry;
@ -1956,9 +1956,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
*/ */
MmUnlockSectionSegment(Context.Segment); MmUnlockSectionSegment(Context.Segment);
Context.WasDirty = FALSE; Context.WasDirty = FALSE;
if (Context.Segment->Image.Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA || if (IS_SWAP_FROM_SSE(Entry) || PFN_FROM_SSE(Entry) != Page)
IS_SWAP_FROM_SSE(Entry) ||
PFN_FROM_SSE(Entry) != Page)
{ {
Context.Private = TRUE; Context.Private = TRUE;
} }
@ -2346,9 +2344,7 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
/* /*
* Check for a private (COWed) page. * Check for a private (COWed) page.
*/ */
if (Segment->Image.Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA || if (IS_SWAP_FROM_SSE(Entry) || PFN_FROM_SSE(Entry) != Page)
IS_SWAP_FROM_SSE(Entry) ||
PFN_FROM_SSE(Entry) != Page)
{ {
Private = TRUE; Private = TRUE;
} }
@ -2481,9 +2477,7 @@ MmAlterViewAttributes(PMMSUPPORT AddressSpace,
Page = MmGetPfnForProcess(Process, Address); Page = MmGetPfnForProcess(Process, Address);
Protect = PAGE_READONLY; Protect = PAGE_READONLY;
if (Segment->Image.Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA || if (IS_SWAP_FROM_SSE(Entry) || PFN_FROM_SSE(Entry) != Page)
IS_SWAP_FROM_SSE(Entry) ||
PFN_FROM_SSE(Entry) != Page)
{ {
Protect = NewProtect; Protect = NewProtect;
} }