Zero-fill initialized data not contained in image file (2nd try)

svn path=/trunk/; revision=4509
This commit is contained in:
Gé van Geldorp 2003-04-06 12:48:33 +00:00
parent 3fe2b722fd
commit c3fb300cc3

View file

@ -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
{