From c3fb300cc3aef6a1b2c3e014d24682499d416e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sun, 6 Apr 2003 12:48:33 +0000 Subject: [PATCH] Zero-fill initialized data not contained in image file (2nd try) svn path=/trunk/; revision=4509 --- reactos/ntoskrnl/mm/section.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 8a3a9b8a1b0..9eb39cb06da 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.106 2003/04/05 21:57:13 gvg Exp $ +/* $Id: section.c,v 1.107 2003/04/06 12:48:33 gvg Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/section.c @@ -3455,7 +3455,6 @@ MmMapViewOfSection(IN PVOID SectionObject, MmUnlockAddressSpace(AddressSpace); -#if 0 /* * Zero-fill the end of initialized data segments which are not completely * present in the file @@ -3467,12 +3466,17 @@ MmMapViewOfSection(IN PVOID SectionObject, (IMAGE_SECTION_NOLOAD | IMAGE_SECTION_INITIALIZED_DATA)) && Section->Segments[i].RawLength < Section->Segments[i].Length) { + /* PsGetCurrentProcess() might not return our process at this moment, + * let's make sure our address space is being used anyway */ + KeAttachProcess(Process); + RtlZeroMemory((PVOID) (ImageBase + (ULONG_PTR) Section->Segments[i].VirtualAddress) + Section->Segments[i].RawLength, Section->Segments[i].Length - Section->Segments[i].RawLength); + + KeDetachProcess(); } } -#endif } else {