Fixed bug in LdrPEProcessModule() so that it correctly section sizes

svn path=/trunk/; revision=816
This commit is contained in:
Brian Palmer 1999-12-04 04:59:38 +00:00
parent e28f90e740
commit 43014d0391

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.38 1999/11/24 11:51:51 dwelch Exp $ /* $Id: loader.c,v 1.39 1999/12/04 04:59:38 bpalmer Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -565,19 +565,19 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName)
PESectionHeaders[Idx].VirtualAddress + DriverBase); PESectionHeaders[Idx].VirtualAddress + DriverBase);
memcpy(PESectionHeaders[Idx].VirtualAddress + DriverBase, memcpy(PESectionHeaders[Idx].VirtualAddress + DriverBase,
(PVOID)(ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData), (PVOID)(ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData),
PESectionHeaders[Idx].SizeOfRawData); PESectionHeaders[Idx].Misc.VirtualSize /*SizeOfRawData*/);
} }
else else
{ {
DPRINT("PESectionHeaders[Idx].VirtualAddress + DriverBase %x\n", DPRINT("PESectionHeaders[Idx].VirtualAddress + DriverBase %x\n",
PESectionHeaders[Idx].VirtualAddress + DriverBase); PESectionHeaders[Idx].VirtualAddress + DriverBase);
memset(PESectionHeaders[Idx].VirtualAddress + DriverBase, memset(PESectionHeaders[Idx].VirtualAddress + DriverBase,
'\0', PESectionHeaders[Idx].SizeOfRawData); '\0', PESectionHeaders[Idx].Misc.VirtualSize /*SizeOfRawData*/);
} }
CurrentSize += ROUND_UP(PESectionHeaders[Idx].SizeOfRawData, CurrentSize += ROUND_UP(PESectionHeaders[Idx].Misc.VirtualSize /*SizeOfRawData*/,
PEOptionalHeader->SectionAlignment); PEOptionalHeader->SectionAlignment);
// CurrentBase = (PVOID)((DWORD)CurrentBase + // CurrentBase = (PVOID)((DWORD)CurrentBase +
// ROUND_UP(PESectionHeaders[Idx].SizeOfRawData, // ROUND_UP(PESectionHeaders[Idx].Misc.VirtualSize /*SizeOfRawData*/,
// PEOptionalHeader->SectionAlignment)); // PEOptionalHeader->SectionAlignment));
} }