From f312ea437173bec8b95d5633ca6a3233f6d8f187 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Thu, 24 Jul 2003 18:37:44 +0000 Subject: [PATCH] - Fixed the loading of a segment which raw size is lower than the virtual size. svn path=/trunk/; revision=5251 --- reactos/ntoskrnl/mm/section.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 456eefe1ff3..630e5c42f42 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: section.c,v 1.124 2003/07/21 21:53:53 royce Exp $ +/* $Id: section.c,v 1.125 2003/07/24 18:37:44 hbirr Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/section.c @@ -913,20 +913,27 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace, MmUnlockAddressSpace(AddressSpace); if ((Segment->Flags & MM_PAGEFILE_SEGMENT) || - (Offset > Segment->RawLength && Section->AllocationAttributes & SEC_IMAGE)) + (Offset >= PAGE_ROUND_UP(Segment->RawLength) && Section->AllocationAttributes & SEC_IMAGE)) { Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page); + if (!NT_SUCCESS(Status)) + { + DPRINT1("MmRequestPageMemoryConsumer failed (Status %x)\n", Status); + } } else { Status = MiReadPage(MemoryArea, Offset, &Page); + if (!NT_SUCCESS(Status)) + { + DPRINT1("MiReadPage failed (Status %x)\n", Status); + } } - if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE) + if (!NT_SUCCESS(Status)) { /* * FIXME: What do we know in this case? */ - DPRINT1("MiReadPage or MmRequestPageMemoryConsumer failed (Status %x)\n", Status); /* * Cleanup and release locks */